Esempio n. 1
0
def extract_features(feature_vector):
    """Maps a feature vector to whether each feature is continuous or discrete."""
    return [
        DiscreteFeature(feature_vector[0]),
        DiscreteFeature(feature_vector[1]),
        ContinuousFeature(feature_vector[2])
    ]
Esempio n. 2
0
def extract_features(feature_vector):
    """Maps a feature vector to whether each feature is continuous or discrete."""
    return [
        DiscreteFeature(feature_vector[0]),
        ContinuousFeature(feature_vector[1]),
        ContinuousFeature(feature_vector[2]),
        ContinuousFeature(feature_vector[3]),
        ContinuousFeature(feature_vector[4]),
        ContinuousFeature(feature_vector[5]),
        ContinuousFeature(feature_vector[6]),
        ContinuousFeature(feature_vector[7]),
        ContinuousFeature(feature_vector[8]),
        ContinuousFeature(feature_vector[9]),
        ContinuousFeature(feature_vector[10]),
        ContinuousFeature(feature_vector[11]),
        ContinuousFeature(feature_vector[12]),
        ContinuousFeature(feature_vector[13]),
        ContinuousFeature(feature_vector[14]),
        ContinuousFeature(feature_vector[15]),
        ContinuousFeature(feature_vector[16]),
        ContinuousFeature(feature_vector[17]),
        ContinuousFeature(feature_vector[18]),
        ContinuousFeature(feature_vector[19]),
        ContinuousFeature(feature_vector[20]),
        ContinuousFeature(feature_vector[21]),
        ContinuousFeature(feature_vector[22]),
        ContinuousFeature(feature_vector[23]),
        ContinuousFeature(feature_vector[24]),
        ContinuousFeature(feature_vector[25]),
        ContinuousFeature(feature_vector[26]),
        ContinuousFeature(feature_vector[27]),
        ContinuousFeature(feature_vector[28]),
        ContinuousFeature(feature_vector[29])
    ]
 def extract_features(example):
     return [DiscreteFeature(example[0]), DiscreteFeature(example[1])]
 def test_raise_not_fitted_error_if_predict_is_called_before_predict(self):
     clf = NaiveBayes(lambda x: [DiscreteFeature(x[0])])
     with self.assertRaises(NotFittedError):
         clf.predict([0, 1])
 def extract_features(feature_vector):
     return [
         DiscreteFeature(feature_vector[0]),
         DiscreteFeature(feature_vector[1]),
         ContinuousFeature(feature_vector[2])
     ]