scripts package

Submodules

scripts.AssociationMatrix module

class scripts.AssociationMatrix.AssociationMatrix(filename, leftds, rightds, left_sorted_terms, right_sorted_terms, main, rng, mask, type_of_masking, verbose)

Bases: object

Methods

mask_matrix()

validate([metric])

get_error

initialize

update

update_G_left

update_G_right

update_S

get_error()
initialize(initialize_strategy, verbose)
mask_matrix()
update()
update_G_left()
update_G_right()
update_S()
validate(metric=EvaluationMetric.APS)
scripts.AssociationMatrix.list_to_dict(list)
scripts.AssociationMatrix.parse_line(line)
scripts.AssociationMatrix.suppress_stdout()

scripts.Network module

class scripts.Network.Network(graph_topology_file, dirfilename, verbose, rng, mask=1)

Bases: object

The Network class is the representation of all the graph And it contains a instance of AssociationMatrix for each file (every AssociationMatrix contains the decomposition)

Attributes:
graph_topology_filestr

File name describing the topology of the network (setting file).

init_strategystr

Strategy of initialization of the AssociationMatrix in the network. Strategy can be: random, svd, kmeans.

integration_strategystr

Integration strategy of nodes. Strategy can be: union, intersection.

rngGenerator

Random generator

type_of_maskingint

How mask is generated. 0 means fully_random, 1 means random_per_row.

association_matricesList[AssociationMatrix]

Association matrix of the Network

datasetsSet[str]

Set with names of all data sets

dataset_ksDict[str, int]

Dictionary that associate data set name with its rank

filesDict[str, list]

Dictionary that associate to every filename the list [main, ds_left, ds_right]. Main is 1 if is the main matrix, 0 otherwise. ds_left is the dataset on the left of the relationship and ds_right is the dataset on the right.

Methods

get_error()

Method to get the current error of the network

get_main()

Get the main matrix of the network

select_rank(ds_name)

Method to calculate rank for each datatype.

update()

Update the network

validate([metric])

Validate the network, producing performance metrics (APS, AUROC, RMSE)

get_error()

Method to get the current error of the network

Returns:
float

current error of the network

get_main()

Get the main matrix of the network

Returns:
AssociationMatrix

main matrix

select_rank(ds_name)

Method to calculate rank for each datatype. In case of k-means and spherical k-means initialization represents number of clusters. In case of svd rank represents the “compression” magnitude.

Parameters:
ds_namestr

name of the data set

Returns
——-
int

rank

update()

Update the network

validate(metric=EvaluationMetric.APS)

Validate the network, producing performance metrics (APS, AUROC, RMSE)

Parameters:
metricEvaluationMetric, default=EvaluationMetric.APS

Metric to produce

Returns:
Method to produce performance metrics

scripts.processAssociationMatrix module

scripts.processNetwork module

scripts.processNetwork.runNetworkMM(args, results, metricsArr, pos)

creates a Network with Maximum Metrix evaluation

Parameters:
args(dirname_1, dirname_2, rng, metric, max_iter)

args necessary to the Network to be created:

results

shared array containing the best epsilons

metricsArr

shared array containing the Metric samples every 10 iterations

posint

integer identifying the run

scripts.processNetwork.runNetworkRE(args, results, metricsArr, pos)

creates a Network with Relative Error evaluation

Parameters:
args(dirname_1, dirname_2, rng, metric, max_iter)

args necessary to the Network to be created:

results

shared array containing the best epsilons

metricsArr

shared array containing the Metric samples every 10 iterations

posint

integer identifying the run

Module contents