API reference¶
This page lists every public entry point exported from hypertools
(see hypertools/__init__.py), organized roughly in the
canonical pipeline order (GH #153): load/impute,
manip, normalize, reduce, align, cluster, predict, plot/analyze, plus the
model-application core, I/O helpers, and the text/reducer model families
used by manip=/reduce=.
Load¶
|
Load data from a built-in example dataset, a scikit-learn or seaborn named dataset, a local file, a Hugging Face dataset, Google Drive, Dropbox, or any URL |
Save¶
|
Save obj to fname, choosing the output format from the file extension. |
Impute¶
|
Fill missing (NaN) values in data, preserving its shape. |
Manip¶
|
Apply a manipulation (or chain of manipulations) to data. |
Normalize¶
|
Z-transform the columns or rows of an array, or list of arrays |
Reduce¶
|
Reduces dimensionality of an array, or list of arrays |
Autoencoder reducers (GH #162) – optional torch extra
(pip install "hypertools[torch]"); pass by name (e.g.
reduce='Autoencoder') or by class to hypertools.reduce:
A single-hidden-layer (shallow) autoencoder reducer. |
|
A single-hidden-layer autoencoder with an L1 penalty on the hidden activation (sparse coding), encouraging a sparser, more interpretable intermediate representation. |
|
A multi-layer autoencoder reducer with configurable depth. |
|
A 1-D convolutional autoencoder reducer: two Conv1d layers slide across the feature axis (treating each row as a length-n_features, 1-channel signal), exploiting local structure among adjacent features rather than treating every feature independently. |
|
A GRU seq2seq autoencoder reducer for genuine timeseries/trajectory data: the ROWS of x are treated as one time-ordered sequence, and a latent vector is produced PER TIMEPOINT (transform(x) still returns (n_rows, n_components), one row per input row). |
|
A variational autoencoder (VAE) reducer: a probabilistic encoder (mean + log-variance heads) trained with a KL-divergence term toward a standard normal prior, via the reparameterization trick. |
Align¶
|
Aligns a list of datasets into a shared coordinate space. |
|
Function to project from one space to another using Procrustean transformation (shift + scaling + rotation + reflection). |
Cluster¶
|
Performs clustering analysis and returns a list of cluster labels |
Predict¶
|
Forecast t new rows continuing each input dataset. |
Plot¶
|
Plots dimensionality reduced data and parses plot arguments |
|
A |
Set interactive backend¶
|
Set the plotting backend hypertools uses. |
Analyze¶
|
Wrapper function for manip -> normalize -> reduce -> align -> cluster transformations (the canonical 1.0 pipeline order, GH #153): each requested stage is applied to the previous stage's output, in that order (e.g. normalize= output feeds reduce=, whose output feeds align=). |
Apply model¶
|
Apply a model (or pipeline of models) to one or more datasets. |
Names accepted as string model specifications. |
Pipeline¶
hypertools.Pipeline chains fitted pipeline stages for reuse (GH #227
#161). Standalone dispatchers (hypertools.reduce, hypertools.manip,
…) called with return_model=True return a hypertools.Pipeline when
more than one stage ran (and the single fitted wrapper when only one stage
ran); hypertools.plot’s return_model=True bundle always carries a
hypertools.Pipeline under its 'pipeline' key, even for a single
stage. A hypertools.Pipeline can be applied to new data via
.transform() and passed back in via pipeline= to
hypertools.plot/hypertools.analyze.
|
Chain hypertools model specs into one fit/transform-able object. |
Describe¶
|
Describe how well reduced data preserves the raw data's pairwise-distance structure, as a function of the number of dimensions |
Text vectorization¶
|
Turns a list of text samples into a matrix using a vectorizer and a text model |
Gensim text models (GH #198) – optional gensim extra
(pip install "hypertools[gensim]"); pass by name (e.g.
vectorizer='Word2Vec') to hypertools.tools.text2mat:
Vectorizer-stage model: a document's vector is the mean of its tokens' trained gensim Word2Vec word vectors (out-of-vocabulary tokens at transform time are skipped; a document with no known tokens gets the zero vector). |
|
Vectorizer-stage model: a document's vector is either its trained gensim Doc2Vec tag vector (for documents seen during fit) or an inferred vector (Doc2Vec.infer_vector) for new documents at transform time. |
|
Vectorizer-stage model: a document's vector is the mean of its tokens' trained gensim FastText word vectors. |
|
Semantic-stage model: gensim's LdaModel (Latent Dirichlet Allocation) trained over a bag-of-words corpus built internally from a dense document-term matrix (e.g. the output of a vectorizer-stage model). |
|
Semantic-stage model: gensim's LsiModel (Latent Semantic Indexing) trained over a bag-of-words corpus built internally from a dense document-term matrix. |
|
Semantic-stage model: gensim's HdpModel (Hierarchical Dirichlet Process), which discovers its own number of topics from the data rather than taking a fixed num_topics (unlike LdaVectorizer/ LsiVectorizer). |
I/O¶
|
Resolve a live Lab Streaming Layer (LSL) stream and return it as a plain Python iterator of per-sample numeric vectors, compatible with hypertools.io.streaming.is_stream/row_to_vector -- so the result can be passed directly to hyp.plot(..., stream_init=..., stream_chunk= ...). |
Exceptions¶
HyperTools’ I/O, backend, and remote-load/trust errors derive from hypertools.HypertoolsError. Input-validation errors (invalid parameters or data shapes) raise standard ValueError/TypeError with actionable messages.
Base class for all hypertools-specific exceptions. |
|
|
Raised when a plotting backend (matplotlib/plotly) cannot satisfy a request. |
|
Raised for hypertools-specific I/O failures (e.g. loading/streaming data). |
Tools¶
|
Formats data into a list of numpy arrays |
|
Returns indices of missing data |
|
Transforms a Pandas DataFrame into a Numpy array with binarized text columns |