sciquence package

Submodules

sciquence.base module

class sciquence.base.Generator[source]

Bases: sklearn.base.BaseEstimator

fit(X, y=None)[source]
Parameters:X (ndarray, shape (n_samples, n_features)) – Matrix containing data being a sequence or a time series.
Returns:self – Returns self
Return type:object
generate(ln_seq)[source]
class sciquence.base.Miner[source]

Bases: sklearn.base.BaseEstimator

compare(A, B)[source]

Compare two sequences.

Parameters:
  • A (ndarray (n_timesteps, n_features)) – A numpy array
  • B (ndarray (n_timesteps, n_features)) – A numpy array
mine(X, P=None)[source]

Find similar patterns in given sequences

Parameters:
  • X (ndarray (n_timesteps, n_features)) – A numpy array
  • P (ndarray (n_timesteps, n_features)) – Set of searched patterns
class sciquence.base.Processor[source]

Bases: sklearn.base.BaseEstimator

Base class for parallel X and y transformations. Cannot be used directly, you can use only the derived classes. This class contains abstract methods

fit(X, y)[source]

Check data characteristics

Parameters:
  • X (ndarray, shape (n_samples, n_features)) – Matrix containing data being a sequence or a time series.
  • y (ndarray, shape (n_samples, )) – Labels for samples in the matrix X.
Returns:

self – Return self.

Return type:

object,

fit_process(X, y)[source]

Check data characteristics and perform parallel transformation of X and y.

Parameters:
  • X (ndarray, shape (n_samples, n_features)) – Matrix containing data being a sequence or a time series.
  • y (ndarray, shape (n_samples, )) – Labels for samples in the matrix X.
Returns:

  • X_new (ndarray, shape (new_n_samples, new_n_features)) – Tranformed X matrix
  • y_new (ndarray, shape (new_n_samples, )) – Labels for samples in the matrix the transformed matrix X.

process(X, y)[source]

Perform parallel transformation of X and y.

Parameters:
  • X (ndarray, shape (n_samples, n_features)) – Matrix containing data being a sequence or a time series.
  • y (ndarray, shape (n_samples, )) – Labels for samples in the matrix X.
Returns:

  • X_new (ndarray, shape (new_n_samples, new_n_features)) – Tranformed X matrix
  • y_new (ndarray, shape (new_n_samples, )) – Labels for samples in the matrix the transformed matrix X.

sciquence.load_utils module

sciquence.load_utils.load_txt(path)[source]
sciquence.load_utils.remove_punctuation(s)[source]
sciquence.load_utils.word2idx(path)[source]

sciquence.pipeline module

The imblearn.pipeline module implements utilities to build a composite estimator, as a chain of transforms, samples and estimators.

class sciquence.pipeline.Pipeline(steps)[source]

Bases: sklearn.pipeline.Pipeline

Pipeline of transforms and resamples with a final estimator.

Sequentially apply a list of transforms, samples and a final estimator. Intermediate steps of the pipeline must be transformers or resamplers, that is, they must implement fit, transform and sample methods. The final estimator only needs to implement fit.

The purpose of the pipeline is to assemble several steps that can be cross-validated together while setting different parameters. For this, it enables setting parameters of the various steps using their names and the parameter name separated by a ‘__’, as in the example below.

Parameters:steps (list) – List of (name, transform) tuples (implementing fit/transform/fit_sample) that are chained, in the order in which they are chained, with the last object an estimator.
named_steps

Read-only attribute to access any step parameter by user given name. Keys are step names and values are steps parameters.

Type:dict
decision_function(**kwargs)[source]

Applies transforms to the data, and the decision_function method of the final estimator. Valid only if the final estimator implements decision_function.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.
fit(X, y=None, **fit_params)[source]

Fit all the transforms and samples one after the other and transform the data, then fit the transformed data using the final estimator.

Parameters:
  • X (iterable) – Training data. Must fulfill input requirements of first step of the pipeline.
  • y (iterable, default=None) – Training targets. Must fulfill label requirements for all steps of the pipeline.
fit_predict(**kwargs)[source]

Applies fit_predict of last step in pipeline after transforms and samples.

Applies fit_transforms or fit_samples of a pipeline to the data, followed by the fit_predict method of the final estimator in the pipeline. Valid only if the final estimator implements fit_predict.

Parameters:
  • X (iterable) – Training data. Must fulfill input requirements of first step of the pipeline.
  • y (iterable, default=None) – Training targets. Must fulfill label requirements for all steps of the pipeline.
fit_sample(**kwargs)[source]

Fit all the transforms and samples one after the other and transform or sample the data, then use fit_sample on transformed data using the final estimator.

Parameters:
  • X (iterable) – Training data. Must fulfill input requirements of first step of the pipeline.
  • y (iterable, default=None) – Training targets. Must fulfill label requirements for all steps of the pipeline.
fit_transform(X, y=None, **fit_params)[source]

Fit all the transforms and samples one after the other and transform or sample the data, then use fit_transform on transformed data using the final estimator.

Parameters:
  • X (iterable) – Training data. Must fulfill input requirements of first step of the pipeline.
  • y (iterable, default=None) – Training targets. Must fulfill label requirements for all steps of the pipeline.
inverse_transform(**kwargs)[source]

Applies inverse transform to the data. Starts with the last step of the pipeline and applies inverse_transform in inverse order of the pipeline steps. Valid only if all steps of the pipeline implement inverse_transform.

Parameters:X (iterable) – Data to inverse transform. Must fulfill output requirements of the last step of the pipeline.
predict(**kwargs)[source]

Applies transforms to the data, and the predict method of the final estimator. Valid only if the final estimator implements predict.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.
predict_log_proba(**kwargs)[source]

Applies transforms to the data, and the predict_log_proba method of the final estimator. Valid only if the final estimator implements predict_log_proba.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.
predict_proba(**kwargs)[source]

Applies transforms to the data, and the predict_proba method of the final estimator. Valid only if the final estimator implements predict_proba.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.
sample(**kwargs)[source]

Applies transforms to the data, and the sample method of the final estimator. Valid only if the final estimator implements sample.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.
score(**kwargs)[source]

Applies transforms to the data, and the score method of the final estimator. Valid only if the final estimator implements score.

Parameters:
  • X (iterable) – Data to score. Must fulfill input requirements of first step of the pipeline.
  • y (iterable, default=None) – Targets used for scoring. Must fulfill label requirements for all steps of the pipeline.
transform(**kwargs)[source]

Applies transforms to the data, and the transform method of the final estimator. Valid only if the final estimator implements transform.

Parameters:X (iterable) – Data to predict on. Must fulfill input requirements of first step of the pipeline.

sciquence.seeker module

sciquence.similarity module

Module contents