class Pool extends Params with HasLabelCol with HasFeaturesCol with HasWeightCol
CatBoost's abstraction of a dataset.
Features data can be stored in raw (features column has org.apache.spark.ml.linalg.Vector type)
or quantized (float feature values are quantized into integer bin values, features column has
Array[Byte] type) form.
Raw Pool can be transformed to quantized form using quantize method.
This is useful if this dataset is used for training multiple times and quantization parameters do not
change. Pre-quantized Pool allows to cache quantized features data and so do not re-run
feature quantization step at the start of an each training.
- Alphabetic
- By Inheritance
- Pool
- HasWeightCol
- HasFeaturesCol
- HasLabelCol
- Params
- Serializable
- Serializable
- Identifiable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Pool(data: DataFrame)
Construct Pool from DataFrame Call set*Col methods to specify non-default columns.
Construct Pool from DataFrame Call set*Col methods to specify non-default columns. Only features and label columns with "features" and "label" names are assumed by default.
val spark = SparkSession.builder() .master("local[4]") .appName("PoolTest") .getOrCreate(); val srcData = Seq( Row(Vectors.dense(0.1, 0.2, 0.11), "0.12", 0x0L, 0.12f), Row(Vectors.dense(0.97, 0.82, 0.33), "0.22", 0x0L, 0.18f), Row(Vectors.dense(0.13, 0.22, 0.23), "0.34", 0x1L, 1.0f) ) val srcDataSchema = Seq( StructField("features", SQLDataTypes.VectorType), StructField("label", StringType), StructField("groupId", LongType), StructField("weight", FloatType) ) val df = spark.createDataFrame(spark.sparkContext.parallelize(srcData), StructType(srcDataSchema)) val pool = new Pool(df) .setGroupIdCol("groupId") .setWeightCol("weight") pool.data.show()
Example: - new Pool(uid: String, data: DataFrame = null, featuresLayout: TFeaturesLayout = null, quantizedFeaturesInfo: QuantizedFeaturesInfoPtr = null)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
$[T](param: Param[T]): T
- Attributes
- protected
- Definition Classes
- Params
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- final val baselineCol: Param[String]
-
final
def
clear(param: Param[_]): Pool.this.type
- Definition Classes
- Params
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
copy(extra: ParamMap): Pool
- Definition Classes
- Pool → Params
-
def
copyValues[T <: Params](to: T, extra: ParamMap): T
- Attributes
- protected
- Definition Classes
- Params
-
def
count: Long
- returns
Number of objects in the dataset, similar to the same method of org.apache.spark.sql.Dataset
-
def
createQuantizationSchema(quantizationParams: QuantizationParamsTrait): QuantizedFeaturesInfoPtr
- Attributes
- protected
-
def
createQuantized(quantizedFeaturesInfo: QuantizedFeaturesInfoPtr): Pool
- Attributes
- protected
- val data: DataFrame
-
final
def
defaultCopy[T <: Params](extra: ParamMap): T
- Attributes
- protected
- Definition Classes
- Params
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
explainParam(param: Param[_]): String
- Definition Classes
- Params
-
def
explainParams(): String
- Definition Classes
- Params
-
final
def
extractParamMap(): ParamMap
- Definition Classes
- Params
-
final
def
extractParamMap(extra: ParamMap): ParamMap
- Definition Classes
- Params
-
final
val
featuresCol: Param[String]
- Definition Classes
- HasFeaturesCol
-
var
featuresLayout: TFeaturesLayout
- Attributes
- protected
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
get[T](param: Param[T]): Option[T]
- Definition Classes
- Params
- final def getBaselineCol: String
-
def
getBaselineCount: Int
- returns
dimension of formula baseline, 0 if no baseline specified
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
getDefault[T](param: Param[T]): Option[T]
- Definition Classes
- Params
- def getFeatureCount: Int
- def getFeatureNames: Array[String]
-
final
def
getFeaturesCol: String
- Definition Classes
- HasFeaturesCol
- def getFeaturesLayout: TFeaturesLayout
- final def getGroupIdCol: String
- final def getGroupWeightCol: String
-
final
def
getLabelCol: String
- Definition Classes
- HasLabelCol
-
final
def
getOrDefault[T](param: Param[T]): T
- Definition Classes
- Params
-
def
getParam(paramName: String): Param[Any]
- Definition Classes
- Params
- final def getSampleIdCol: String
- final def getSubgroupIdCol: String
- def getTargetType: ERawTargetType
- final def getTimestampCol: String
-
final
def
getWeightCol: String
- Definition Classes
- HasWeightCol
- final val groupIdCol: Param[String]
- final val groupWeightCol: Param[String]
-
final
def
hasDefault[T](param: Param[T]): Boolean
- Definition Classes
- Params
-
def
hasParam(paramName: String): Boolean
- Definition Classes
- Params
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isDefined(param: Param[_]): Boolean
- Definition Classes
- Params
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isQuantized: Boolean
-
final
def
isSet(param: Param[_]): Boolean
- Definition Classes
- Params
-
final
val
labelCol: Param[String]
- Definition Classes
- HasLabelCol
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
lazy val
params: Array[Param[_]]
- Definition Classes
- Params
-
def
quantize(quantizedFeaturesInfo: QuantizedFeaturesInfoPtr): Pool
Create Pool with quantized features from Pool with raw features.
Create Pool with quantized features from Pool with raw features. This variant of the method is useful if QuantizedFeaturesInfo with data for quantization (borders and nan modes) has already been computed. Used, for example, to quantize evaluation datasets after the training dataset has been quantized.
-
def
quantize(quantizationParams: QuantizationParamsTrait): Pool
Create Pool with quantized features from Pool with raw features
val spark = SparkSession.builder() .master("local[*]") .appName("QuantizationTest") .getOrCreate(); val srcData = Seq( Row(Vectors.dense(0.1, 0.2, 0.11), "0.12"), Row(Vectors.dense(0.97, 0.82, 0.33), "0.22"), Row(Vectors.dense(0.13, 0.22, 0.23), "0.34") ) val srcDataSchema = Seq( StructField("features", SQLDataTypes.VectorType), StructField("label", StringType) ) val df = spark.createDataFrame(spark.sparkContext.parallelize(srcData), StructType(srcDataSchema)) val pool = new Pool(df) val quantizedPool = pool.quantize(new QuantizationParams) val quantizedPoolWithTwoBinsPerFeature = pool.quantize(new QuantizationParams().setBorderCount(1)) quantizedPool.data.show() quantizedPoolWithTwoBinsPerFeature.data.show()
Example: - val quantizedFeaturesInfo: QuantizedFeaturesInfoPtr
-
def
repartition(partitionCount: Int, byGroupColumnsIfPresent: Boolean = true): Pool
Repartion data to the specified number of partitions.
Repartion data to the specified number of partitions. Useful to repartition data to create one partition per executor for training (where each executor gets its' own CatBoost worker with a part of the training data).
- final val sampleIdCol: Param[String]
-
final
def
set(paramPair: ParamPair[_]): Pool.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
set(param: String, value: Any): Pool.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
set[T](param: Param[T], value: T): Pool.this.type
- Definition Classes
- Params
- final def setBaselineCol(value: String): Pool.this.type
-
final
def
setDefault(paramPairs: ParamPair[_]*): Pool.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
setDefault[T](param: Param[T], value: T): Pool.this.type
- Attributes
- protected
- Definition Classes
- Params
- def setFeaturesCol(value: String): Pool
- final def setGroupIdCol(value: String): Pool.this.type
- final def setGroupWeightCol(value: String): Pool.this.type
- def setLabelCol(value: String): Pool
- final def setSampleIdCol(value: String): Pool.this.type
- final def setSubgroupIdCol(value: String): Pool.this.type
- final def setTimestampCol(value: String): Pool.this.type
- def setWeightCol(value: String): Pool
- final val subgroupIdCol: Param[String]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- final val timestampCol: Param[String]
-
def
toString(): String
- Definition Classes
- Identifiable → AnyRef → Any
-
val
uid: String
- Definition Classes
- Pool → Identifiable
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
val
weightCol: Param[String]
- Definition Classes
- HasWeightCol