CountVectorizer Class

Definition

public class CountVectorizer : Microsoft.Spark.ML.Feature.FeatureBase<Microsoft.Spark.ML.Feature.CountVectorizer>
type CountVectorizer = class
    inherit FeatureBase<CountVectorizer>
Public Class CountVectorizer
Inherits FeatureBase(Of CountVectorizer)
Inheritance

Constructors

CountVectorizer()

Creates a CountVectorizer without any parameters.

CountVectorizer(String)

Creates a CountVectorizer with a UID that is used to give the CountVectorizer a unique ID.

Methods

Clear(Param)

Clears any value that was previously set for this Microsoft.Spark.ML.Feature.Param. The value is reset to the default value.

(Inherited from FeatureBase<T>)
ExplainParam(Param)

Returns a description of how a specific Microsoft.Spark.ML.Feature.Param works and is currently set.

(Inherited from FeatureBase<T>)
ExplainParams()

Returns a description of how all of the Microsoft.Spark.ML.Feature.Param's that apply to this object work and how they are currently set.

(Inherited from FeatureBase<T>)
Fit(DataFrame)

Fits a model to the input data.

GetBinary()

Gets the binary toggle to control the output vector values. If True, all nonzero counts (after minTF filter applied) are set to 1. This is useful for discrete probabilistic models that model binary events rather than integer counts. Default: false

GetInputCol()

Gets the column that the CountVectorizer should read from and convert into buckets. This would have been set by SetInputCol.

GetMaxDF()

Gets the maximum number of different documents a term could appear in to be included in the vocabulary. A term that appears more than the threshold will be ignored. If this is an integer greater than or equal to 1, this specifies the maximum number of documents the term could appear in; if this is a double in [0,1), then this specifies the maximum fraction of documents the term could appear in.

GetMinDF()

Gets the minimum number of different documents a term must appear in to be included in the vocabulary. If this is an integer greater than or equal to 1, this specifies the number of documents the term must appear in; if this is a double in [0,1), then this specifies the fraction of documents.

GetMinTF()

Gets the filter to ignore rare words in a document. For each document, terms with frequency/count less than the given threshold are ignored. If this is an integer greater than or equal to 1, then this specifies a count (of times the term must appear in the document); if this is a double in [0,1), then this specifies a fraction (out of the document's token count).

Note that the parameter is only used in transform of CountVectorizerModel and does not affect fitting.

GetOutputCol()

Gets the name of the new column the CountVectorizer creates in the DataFrame.

GetParam(String)

Retrieves a Microsoft.Spark.ML.Feature.Param so that it can be used to set the value of the Microsoft.Spark.ML.Feature.Param on the object.

(Inherited from FeatureBase<T>)
GetVocabSize()

Gets the max size of the vocabulary. CountVectorizer will build a vocabulary that only considers the top vocabSize terms ordered by term frequency across the corpus.

Load(String)

Loads the CountVectorizer that was previously saved using Save.

Save(String)

Saves the object so that it can be loaded later using Load. Note that these objects can be shared with Scala by Loading or Saving in Scala.

(Inherited from FeatureBase<T>)
Set(Param, Object)

Sets the value of a specific Microsoft.Spark.ML.Feature.Param.

(Inherited from FeatureBase<T>)
SetBinary(Boolean)

Sets the binary toggle to control the output vector values. If True, all nonzero counts (after minTF filter applied) are set to 1. This is useful for discrete probabilistic models that model binary events rather than integer counts. Default: false

SetInputCol(String)

Sets the column that the CountVectorizer should read from.

SetMaxDF(Double)

Sets the maximum number of different documents a term could appear in to be included in the vocabulary. A term that appears more than the threshold will be ignored. If this is an integer greater than or equal to 1, this specifies the maximum number of documents the term could appear in; if this is a double in [0,1), then this specifies the maximum fraction of documents the term could appear in.

SetMinDF(Double)

Sets the minimum number of different documents a term must appear in to be included in the vocabulary. If this is an integer greater than or equal to 1, this specifies the number of documents the term must appear in; if this is a double in [0,1), then this specifies the fraction of documents.

SetMinTF(Double)

Sets the filter to ignore rare words in a document. For each document, terms with frequency/count less than the given threshold are ignored. If this is an integer greater than or equal to 1, then this specifies a count (of times the term must appear in the document); if this is a double in [0,1), then this specifies a fraction (out of the document's token count).

Note that the parameter is only used in transform of CountVectorizerModel and does not affect fitting.

SetOutputCol(String)

Sets the name of the new column the CountVectorizer creates in the DataFrame.

SetVocabSize(Int32)

Sets the max size of the vocabulary. CountVectorizer will build a vocabulary that only considers the top vocabSize terms ordered by term frequency across the corpus.

ToString()

Returns the JVM toString value rather than the .NET ToString default

(Inherited from FeatureBase<T>)
Uid()

The UID that was used to create the object. If no UID is passed in when creating the object then a random UID is created when the object is created.

(Inherited from FeatureBase<T>)

Applies to