Table Of Contents

This Page

utils Package

crossvalidation_utils Module

Created on Oct 9, 2012

@author: georgianadinu

composes.utils.crossvalidation_utils.get_split_indices(range_len, fold)
composes.utils.crossvalidation_utils.get_submatrix_list(matrix_, indices_list)

io_utils Module

Created on Oct 16, 2012

@author: nghia

composes.utils.io_utils.create_directories(directory)
composes.utils.io_utils.create_parent_directories(file_name)
composes.utils.io_utils.extract_indexing_structs(filename, field_list)
composes.utils.io_utils.load(file_name, data_type=None)
composes.utils.io_utils.print_cooc_mat_dense_format(matrix_, id2row, file_prefix)
composes.utils.io_utils.print_cooc_mat_sparse_format(matrix_, id2row, id2column, file_prefix)
composes.utils.io_utils.print_list(list_, file_name)
composes.utils.io_utils.read_list(file_name, **kwargs)
composes.utils.io_utils.read_tuple_list(data_file, **kwargs)
composes.utils.io_utils.save(object_, file_name)

log_utils Module

Created on Oct 15, 2012

@author: georgianadinu

composes.utils.log_utils.config_logging(file_name, level=20, format_='')
composes.utils.log_utils.get_ident(delim, ident_level)
composes.utils.log_utils.get_learner_info(learner, ident)
composes.utils.log_utils.print_composition_model_info(logger_, model, ident_level, intro_string)
composes.utils.log_utils.print_info(logger_, ident_level, text)
composes.utils.log_utils.print_matrix_info(logger_, matrix_, ident_level, intro_string)
composes.utils.log_utils.print_name(logger_, object_, ident_level, intro_string)
composes.utils.log_utils.print_time_info(logger_, end, beg, ident_level)
composes.utils.log_utils.print_transformation_info(logger_, trans, ident_level, intro_string)

matrix_utils Module

composes.utils.matrix_utils.assert_is_array_or_matrix(data)
composes.utils.matrix_utils.assert_same_shape(matrix1, matrix2, axis=None)
composes.utils.matrix_utils.get_type_of_largest(matrix_list)
composes.utils.matrix_utils.is_array_or_matrix(data)
composes.utils.matrix_utils.matrix_type_conflict(matrix_list)
composes.utils.matrix_utils.padd_matrix(matrix_, axis, value=1)
composes.utils.matrix_utils.resolve_type_conflict(matrix_list, matrix_type)
composes.utils.matrix_utils.to_compatible_matrix_types(v1, v2)
composes.utils.matrix_utils.to_matrix(matrix_)

Converts an array-like structure to a DenseMatrix/SparseMatrix

mem_utils Module

Created on Sep 21, 2012

@author: georgianadinu

composes.utils.mem_utils.get_mem_usage()

num_utils Module

Created on Sep 18, 2012

@author: georgianadinu

composes.utils.num_utils.is_integer(operand)
composes.utils.num_utils.is_numeric(operand)

py_matrix_utils Module

Created on Sep 19, 2012

@author: georgianadinu

composes.utils.py_matrix_utils.array_to_csr_diagonal(array_)
composes.utils.py_matrix_utils.is_array(operand)
composes.utils.py_matrix_utils.nonzero_invert(matrix_)

Performs 1/x for all x, non-zero elements of the matrix.

Params:
matrix_: np.matrix

regression_learner Module

class composes.utils.regression_learner.LstsqRegressionLearner(**kwargs)

Bases: composes.utils.regression_learner.RegressionLearner

This class performs Least Squares Regression.

It finds the matrix X which solves:

\(X = argmin(||AX - B||_2)\)

It can be used with intercept or without (by default intercept=True).

train(matrix_a, matrix_b)
class composes.utils.regression_learner.RegressionLearner

Bases: object

Implements a set of regression methods.

Supported regression methods are least squares regression and ridge regression. Ridge regression can be used with generalized cross validation. (Hastie, Tibshirani and Friedman, Second edition, page 244)

has_intercept()
class composes.utils.regression_learner.RidgeRegressionLearner(**kwargs)

Bases: composes.utils.regression_learner.RegressionLearner

This class performs Ridge Regression.

It finds the matrix X which solves:

\(X = argmin(||AX - B||_2 + \lambda||X||_2)\)

It can be used with intercept or without (by default intercept=True). Cross validation can be used with default \(\lambda\) range of \(linspace(0, 5, 11)\). By default Generalized cross validation is performed. If cross validation is set False it requires the input of a \(\lambda\) value.

train(matrix_a, matrix_b)

If cross validation is set to True, it performs generalized cross validation. (Hastie, Tibshirani and Friedman, Second edition, page 244).

scoring_utils Module

Created on Oct 17, 2012

@author: georgianadinu

composes.utils.scoring_utils.auc(gold, prediction)
composes.utils.scoring_utils.pearson(gold, prediction)
composes.utils.scoring_utils.score(gold, prediction, method)
composes.utils.scoring_utils.spearman(gold, prediction)

space_utils Module

Created on Sep 26, 2012

@author: georgianadinu

composes.utils.space_utils.add_items_to_dict(dict_, list_)
composes.utils.space_utils.assert_dict_match_list(dict_, list_)
composes.utils.space_utils.assert_is_instance(object_, class_)
composes.utils.space_utils.assert_shape_consistent(matrix_, id2row, id2column, row2id, column2id)
composes.utils.space_utils.get_partitions(sorted_list, min_samples)
composes.utils.space_utils.list2dict(list_)
composes.utils.space_utils.read_dense_space_data(matrix_file, row2id, **kwargs)
composes.utils.space_utils.read_sparse_space_data(matrix_file, row2id, column2id, **kwargs)