KFold¶
- class KFold(*args)¶
- K-fold. - Parameters:
- kpositive integer
- Number of folds in which the sample is split. If not provided, default is - . 
 
 - Methods - Accessor to the object's name. - getK()- Accessor to the number of folds. - getName()- Accessor to the object's name. - hasName()- Test if the object is named. - run(x, y, weight, basis, indices)- Run the algorithm. - setK(p)- Accessor to the number of folds. - setName(name)- Accessor to the object's name. - See also - Notes - KFold inherits from - FittingAlgorithm.- Examples - >>> import openturns as ot >>> size = 100 >>> xuniform = ot.Uniform(0.9, 1.1) >>> x = xuniform.getSample(size) >>> yuniform = ot.Uniform(1.9, 2.1) >>> y = yuniform.getSample(size) >>> w = [1.0] * size >>> f = ot.SymbolicFunction(['x'], ['2.0 * x']) >>> basis = [f] >>> indices = [0] >>> fittingAlgo = ot.KFold() >>> result = fittingAlgo.run(x, y, w, basis, indices) - __init__(*args)¶
 - getClassName()¶
- Accessor to the object’s name. - Returns:
- class_namestr
- The object class name (object.__class__.__name__). 
 
 
 - getK()¶
- Accessor to the number of folds. - Returns:
- kint
- Number of folds in which the sample is split. 
 
 
 - getName()¶
- Accessor to the object’s name. - Returns:
- namestr
- The name of the object. 
 
 
 - hasName()¶
- Test if the object is named. - Returns:
- hasNamebool
- True if the name is not empty. 
 
 
 - run(x, y, weight, basis, indices)¶
- Run the algorithm. - Parameters:
- x2-d sequence of float
- Input sample 
- y2-d sequence of float
- Output sample 
- weightsequence of float
- Weights associated to the outputs 
- psisequence of Function
- Basis 
- indicessequence of int
- Indices of the basis 
 
- Returns:
- measurefloat
- Fitting measure 
 
 
 - setK(p)¶
- Accessor to the number of folds. - Parameters:
- kint
- Number of folds in which the sample is split. 
 
 
 - setName(name)¶
- Accessor to the object’s name. - Parameters:
- namestr
- The name of the object. 
 
 
 
 OpenTURNS
      OpenTURNS
    