pub fn update(&mut self, model: tangram_model::ModelReader, value: Option<&serde_json::Value>) {
		let column_name = self.column_name().to_string();
		match self {
			ProductionColumnStats::Unknown(stats) => stats.update(value),
			ProductionColumnStats::Text(stats) => {
				// To update text stats, we need to know which ngrams we're looking for, and how
				// to tokenize the input.  We'll read that configuration out of the model data.

				// Get this model's stats information for all columns
				let col_stats = match model.inner() {
					tangram_model::ModelInnerReader::Regressor(regressor) => {
						regressor.read().train_column_stats()
					}
					tangram_model::ModelInnerReader::BinaryClassifier(binary_classifier) => {
						binary_classifier.read().train_column_stats()
					}
					tangram_model::ModelInnerReader::MulticlassClassifier(
						multiclass_classifier,
					) => multiclass_classifier.read().train_column_stats(),
				};

				// Get the stats from the model for this text column
				let text_column_stats = col_stats
					.iter()
					.find(|column| column.column_name() == column_name)
					.unwrap()
					.as_text_column()
					.unwrap();

				// Get the tokenizer configuration this column uses.
				let tokenizer: Tokenizer = text_column_stats.tokenizer().into();

				// Get which ngrams we're tracking, and the types of those ngrams.
				let tracked_ngrams: IndexSet<NGramRef> = text_column_stats
					.top_ngrams()
					.iter()
					.map(|(ngram, _)| ngram.into())
					.collect();
				let ngram_types: IndexSet<NGramType> = text_column_stats
					.ngram_types()
					.iter()
					.map(|ngram_type| match ngram_type {
						tangram_model::NGramTypeReader::Unigram(_) => NGramType::Unigram,
						tangram_model::NGramTypeReader::Bigram(_) => NGramType::Bigram,
					})
					.collect();

				// Interpret the value and update the statistics.
				stats.update(value, &tokenizer, &tracked_ngrams, &ngram_types)
			}
			ProductionColumnStats::Number(stats) => stats.update(value),
			ProductionColumnStats::Enum(stats) => stats.update(value),
		}
	}
/// Incorporate a data value into the statistics being tracked.
Incorporate a data value into the statistics being tracked.
Incorporate a data value into the statistics being tracked .
pub fn update(&mut self, model: tangram_model::ModelReader, value: Option<&serde_json::Value>) {
		let column_name = self.column_name().to_string();
		match self {
			ProductionColumnStats::Unknown(stats) => stats.update(value),
			ProductionColumnStats::Text(stats) => {
				// To update text stats, we need to know which ngrams we're looking for, and how
				// to tokenize the input.  We'll read that configuration out of the model data.
				// Get this model's stats information for all columns
				let col_stats = match model.inner() {
					tangram_model::ModelInnerReader::Regressor(regressor) => {
						regressor.read().train_column_stats()
					}
					tangram_model::ModelInnerReader::BinaryClassifier(binary_classifier) => {
						binary_classifier.read().train_column_stats()
					}
					tangram_model::ModelInnerReader::MulticlassClassifier(
						multiclass_classifier,
					) => multiclass_classifier.read().train_column_stats(),
				};
				// Get the stats from the model for this text column
				let text_column_stats = col_stats
					.iter()
					.find(|column| column.column_name() == column_name)
					.unwrap()
					.as_text_column()
					.unwrap();
				// Get the tokenizer configuration this column uses.
				let tokenizer: Tokenizer = text_column_stats.tokenizer().into();
				// Get which ngrams we're tracking, and the types of those ngrams.
				let tracked_ngrams: IndexSet<NGramRef> = text_column_stats
					.top_ngrams()
					.iter()
					.map(|(ngram, _)| ngram.into())
					.collect();
				let ngram_types: IndexSet<NGramType> = text_column_stats
					.ngram_types()
					.iter()
					.map(|ngram_type| match ngram_type {
						tangram_model::NGramTypeReader::Unigram(_) => NGramType::Unigram,
						tangram_model::NGramTypeReader::Bigram(_) => NGramType::Bigram,
					})
					.collect();
				// Interpret the value and update the statistics.
				stats.update(value, &tokenizer, &tracked_ngrams, &ngram_types)
			}
			ProductionColumnStats::Number(stats) => stats.update(value),
			ProductionColumnStats::Enum(stats) => stats.update(value),
		}
	}
pub fn update ( & mut self , model : tangram_model :: ModelReader , value : Option < & serde_json :: Value > ) { let column_name = self . column_name ( ) . to_string ( ) ; match self { ProductionColumnStats :: Unknown ( stats ) => stats . update ( value ) , ProductionColumnStats :: Text ( stats ) => { // To update text stats, we need to know which ngrams we're looking for, and how // to tokenize the input.  We'll read that configuration out of the model data. // Get this model's stats information for all columns let col_stats = match model . inner ( ) { tangram_model :: ModelInnerReader :: Regressor ( regressor ) => { regressor . read ( ) . train_column_stats ( ) } tangram_model :: ModelInnerReader :: BinaryClassifier ( binary_classifier ) => { binary_classifier . read ( ) . train_column_stats ( ) } tangram_model :: ModelInnerReader :: MulticlassClassifier ( multiclass_classifier , ) => multiclass_classifier . read ( ) . train_column_stats ( ) , } ; // Get the stats from the model for this text column let text_column_stats = col_stats . iter ( ) . find ( | column | column . column_name ( ) == column_name ) . unwrap ( ) . as_text_column ( ) . unwrap ( ) ; // Get the tokenizer configuration this column uses. let tokenizer : Tokenizer = text_column_stats . tokenizer ( ) . into ( ) ; // Get which ngrams we're tracking, and the types of those ngrams. let tracked_ngrams : IndexSet < NGramRef > = text_column_stats . top_ngrams ( ) . iter ( ) . map ( | ( ngram , _ ) | ngram . into ( ) ) . collect ( ) ; let ngram_types : IndexSet < NGramType > = text_column_stats . ngram_types ( ) . iter ( ) . map ( | ngram_type | match ngram_type { tangram_model :: NGramTypeReader :: Unigram ( _ ) => NGramType :: Unigram , tangram_model :: NGramTypeReader :: Bigram ( _ ) => NGramType :: Bigram , } ) . collect ( ) ; // Interpret the value and update the statistics. stats . update ( value , & tokenizer , & tracked_ngrams , & ngram_types ) } ProductionColumnStats :: Number ( stats ) => stats . update ( value ) , ProductionColumnStats :: Enum ( stats ) => stats . update ( value ) , } }
Incorporate a data value into the statistics being tracked.
Incorporate a data value into the statistics being tracked .
&mut self
model
tangram_model::ModelReader
value
Option<&serde_json::Value>