SciPy

tethne.model.basemodel module

class tethne.model.basemodel.BaseModel(**kwargs)[source]

Bases: object

Base class for models. Should not be instantiated directly.

Use a model class in tethne.model instead.

dimension(d, top=None, asmatrix=False, **kwargs)[source]

Describes a dimension (eg a topic).

Subclass must provide _dimension_description(d) method.

Parameters:

d : int

Dimension index.

Returns:

description : list

A list of ( feature, weight ) tuples (e.g. word, prob ).

dimension_items(d, threshold, **kwargs)[source]

Describes a dimension in terms of the items that contain it.

Subclass must provide _dimension_items(d, threshold) method.

Parameters:

d : int

Dimension index.

threshold : float

Minimum representation of d in item.

Returns:

description : list

A list of ( item, weight ) tuples.

dimension_relationship(d, e, **kwargs)[source]

Describes the relationship between two dimensions.

Subclass must provide _dimension_relationship(d, e) method.

Parameters:

d : int

Dimension index.

e : int

Dimension index.

Returns:

relationship : list

A list of ( factor , weight ) tuples.

item(i, top=None, **kwargs)[source]

Describes an item in terms of dimensions and weights.

Subclass must provide _item_description(i) method.

Parameters:

i : int

Index for an item.

top : int

(optional) Number of (highest-w) dimensions to return.

Returns:

description : list

A list of ( dimension , weight ) tuples.

item_relationship(i, j, **kwargs)[source]

Describes the relationship between two items.

Subclass must provide _item_relationship(i, j) method.

Parameters:

i : int

Item index.

j : int

Item index.

Returns:

relationship : list

A list of ( dimension , weight ) tuples.