Skip to content

Commit

Permalink
Drop old preprocessor api
Browse files Browse the repository at this point in the history
  • Loading branch information
vinx13 authored and vigsterkr committed Jul 10, 2018
1 parent 8711ea6 commit 6d183fe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 55 deletions.
11 changes: 0 additions & 11 deletions src/shogun/preprocessor/DensePreprocessor.cpp
Expand Up @@ -124,17 +124,6 @@ CDensePreprocessor<ST>::inverse_transform(CFeatures* features, bool inplace)
return preprocessed;
}

template <class ST>
SGMatrix<ST>
CDensePreprocessor<ST>::apply_to_feature_matrix(CFeatures* features)
{
auto simple_features = features->as<CDenseFeatures<ST>>();
auto feature_matrix =
apply_to_matrix(simple_features->get_feature_matrix());
simple_features->set_feature_matrix(feature_matrix);
return feature_matrix;
}

template <class ST>
SGMatrix<ST>
CDensePreprocessor<ST>::inverse_apply_to_matrix(SGMatrix<ST> matrix)
Expand Down
17 changes: 3 additions & 14 deletions src/shogun/preprocessor/DensePreprocessor.h
Expand Up @@ -21,10 +21,9 @@ template <class ST> class CDenseFeatures;
/** @brief Template class DensePreprocessor, base class for preprocessors (cf.
* CPreprocessor) that apply to CDenseFeatures (i.e. rectangular dense matrices)
*
* Two new functions apply_to_feature_vector() and apply_to_feature_matrix()
* are defined in this interface that need to be implemented in each particular
* preprocessor operating on CDenseFeatures. For examples see e.g. CLogPlusOne
* or CPCACut.
* Two new functions apply_to_feature_vector and apply_to_matrix() are defined
* in this interface need to be implemented in each particular preprocessor
* operating on CDenseFeatures. For examples see e.g. CLogPlusOne or CPCACut.
*/
template <class ST> class CDensePreprocessor : public CPreprocessor
{
Expand All @@ -51,16 +50,6 @@ template <class ST> class CDensePreprocessor : public CPreprocessor
virtual CFeatures*
inverse_transform(CFeatures* features, bool inplace = true);

#ifndef SWIG
[[deprecated]]
#endif
/// apply preproc on feature matrix
/// result in feature matrix
/// return pointer to feature_matrix, i.e. f->get_feature_matrix();
// remove after cleaning up codebase
virtual SGMatrix<ST>
apply_to_feature_matrix(CFeatures* features);

/// apply preproc on single feature vector
/// result in feature matrix
virtual SGVector<ST> apply_to_feature_vector(SGVector<ST> vector) = 0;
Expand Down
15 changes: 3 additions & 12 deletions src/shogun/preprocessor/SparsePreprocessor.h
Expand Up @@ -21,11 +21,11 @@ namespace shogun
template <class ST> class SGSparseVector;
template <class ST> class CSparseFeatures;

/** @brief Template class SparsePreprocessor, base class for preprocessors (cf. CPreprocessor)
* that apply to CSparseFeatures
/** @brief Template class SparsePreprocessor, base class for preprocessors (cf.
* CPreprocessor) that apply to CSparseFeatures
*
* Two new functions apply_to_sparse_feature_vector() and
* apply_to_sparse_feature_matrix() are defined in this interface that need to
* apply_to_sparse_matrix() are defined in this interface that need to
* be implemented in each particular preprocessor operating on CSparseFeatures.
*
* */
Expand All @@ -44,15 +44,6 @@ template <class ST> class CSparsePreprocessor : public CPreprocessor
*/
virtual CFeatures* transform(CFeatures* features, bool inplace);

#ifndef SWIG
[[deprecated]]
#endif
/// apply preproc on feature matrix
/// result in feature matrix
/// return pointer to feature_matrix, i.e. f->get_feature_matrix();
virtual SGSparseVector<ST>*
apply_to_sparse_feature_matrix(CSparseFeatures<ST>* f) = 0;

/// apply preproc on single feature vector
/// result in feature matrix
virtual SGSparseVector<ST>*
Expand Down
7 changes: 0 additions & 7 deletions src/shogun/preprocessor/StringPreprocessor.cpp
Expand Up @@ -118,13 +118,6 @@ namespace shogun
return string_features;
}

template <class ST>
bool CStringPreprocessor<ST>::apply_to_string_features(CFeatures* features)
{
transform(features);
return true;
}

template class CStringPreprocessor<bool>;
template class CStringPreprocessor<char>;
template class CStringPreprocessor<int8_t>;
Expand Down
14 changes: 3 additions & 11 deletions src/shogun/preprocessor/StringPreprocessor.h
Expand Up @@ -20,9 +20,10 @@ namespace shogun
template <class ST> class CStringFeatures;

/** @brief Template class StringPreprocessor, base class for preprocessors (cf.
* CPreprocessor) that apply to CStringFeatures (i.e. strings of variable length).
* CPreprocessor) that apply to CStringFeatures (i.e. strings of variable
* length).
*
* Two new functions apply_to_string() and apply_to_string_features()
* Two new functions apply_to_string() and apply_to_string_list()
* are defined in this interface that need to be implemented in each particular
* preprocessor operating on CStringFeatures.
*/
Expand All @@ -40,15 +41,6 @@ template <class ST> class CStringPreprocessor : public CPreprocessor
*/
virtual CFeatures* transform(CFeatures* features, bool inplace = true);

/// apply preproc on feature matrix
/// result in feature matrix
/// return pointer to feature_matrix, i.e. f->get_feature_matrix();
#ifndef SWIG
[[deprecated]]
#endif
virtual bool
apply_to_string_features(CFeatures* f);

/// apply preproc on single feature vector
virtual ST* apply_to_string(ST* f, int32_t &len)=0;

Expand Down

0 comments on commit 6d183fe

Please sign in to comment.