lace.engine module

Class

class lace.engine.Engine(*args, **kwargs)

The cross-categorization model with states and data.

property Engine.shape

A tuple containing the number of rows and the number of columns in the table.

Examples

>>> from lace.examples import Satellites
>>> engine = Satellites()
>>> engine.shape
(1164, 20)
property Engine.n_rows

The number of rows in the table.

Examples

>>> from lace.examples import Satellites
>>> engine = Satellites()
>>> engine.n_rows
1164
property Engine.n_cols

The number of columns in the table.

Examples

>>> from lace.examples import Satellites
>>> engine = Satellites()
>>> engine.n_cols
20
property Engine.n_states

The number of states (independent Markov chains).

Examples

>>> from lace.examples import Satellites
>>> engine = Satellites()
>>> engine.n_states
16
property Engine.columns

A list of the column names appearing in their order in the table.

Examples

>>> from lace.examples import Satellites
>>> engine = Satellites()
>>> engine.columns  
['Country_of_Operator',
 'Users',
 'Purpose',
 'Class_of_Orbit',
 'Type_of_Orbit',
 'Perigee_km',
 'Apogee_km',
 'Eccentricity',
 'Period_minutes',
 'Launch_Mass_kg',
 'Dry_Mass_kg',
 'Power_watts',
 'Date_of_Launch',
 'Expected_Lifetime',
 'Country_of_Contractor',
 'Launch_Site',
 'Launch_Vehicle',
 'Source_Used_for_Orbital_Data',
 'longitude_radians_of_geo',
 'Inclination_radians']
property Engine.index

The string row names of the engine.

property Engine.ftypes

A dictionary mapping column names to feature types.

Examples

>>> from lace.examples import Satellites  
>>> engine = Satellites()  
>>> engine.ftypes  
{'Date_of_Launch': 'Continuous',
 'Purpose': 'Categorical',
 'Period_minutes': 'Continuous',
 'Expected_Lifetime': 'Continuous',
 'longitude_radians_of_geo': 'Continuous',
 'Inclination_radians': 'Continuous',
 'Apogee_km': 'Continuous',
 'Country_of_Contractor': 'Categorical',
 'Eccentricity': 'Continuous',
 'Source_Used_for_Orbital_Data': 'Categorical',
 'Perigee_km': 'Continuous',
 'Dry_Mass_kg': 'Continuous',
 'Country_of_Operator': 'Categorical',
 'Power_watts': 'Continuous',
 'Launch_Site': 'Categorical',
 'Launch_Vehicle': 'Categorical',
 'Type_of_Orbit': 'Categorical',
 'Users': 'Categorical',
 'Launch_Mass_kg': 'Continuous',
 'Class_of_Orbit': 'Categorical'}

Methods

Engine.save(path)

Save the Engine metadata to path.

Engine.ftype(col)

Get the feature type of a column.

Engine.column_assignment(state_ix)

Return the assignment of columns to views.

Engine.row_assignments(state_ix)

Return the assignment of rows to categories for each view.

Engine.diagnostics([name])

Get convergence diagnostics.

Engine.append_rows(rows)

Append new rows to the table.

Engine.update(n_iters, *[, timeout, ...])

Update the Engine by advancing the Markov chains.

Engine.entropy(cols[, n_mc_samples])

Estimate the entropy or joint entropy of one or more features.

Engine.logp(values[, given, state_ixs, scaled])

Compute the log likelihood.

Engine.inconsistency(values[, given])

Compute inconsistency.

Engine.surprisal(col, *[, rows, values, ...])

Compute the surprisal of a values in specific cells.

Engine.simulate(cols[, given, n, include_given])

Simulate data from a conditional distribution.

Engine.draw(row, col[, n])

Draw data from the distribution of a specific cell in the table.

Engine.predict(target[, given, state_ixs, ...])

Predict a single target from a conditional distribution.

Engine.impute(col[, rows, unc_type])

Impute (predict) the value of a cell(s) in the lace table.

Engine.depprob(col_pairs)

Compute the dependence probability between pairs of columns.

Engine.mi(col_pairs[, n_mc_samples, mi_type])

Compute the mutual information between pairs of columns.

Engine.rowsim(row_pairs[, wrt, col_weighted])

Compute the row similarity between pairs of rows.

Engine.novelty(row[, wrt])

Compute the novelty of a row.

Engine.pairwise_fn(fn_name[, indices])

Compute a function for a set of pairs of rows or columns.

Engine.clustermap(fn_name, *[, indices, ...])

Generate a clustermap of a pairwise function.