colda.algorithm.strategy package

Subpackages

Submodules

colda.algorithm.strategy.abstract_algorithm_strategy module

class colda.algorithm.strategy.abstract_algorithm_strategy.AbstractTestAlgorithmStrategy

Bases: ABC

abstract classmethod get_instance()
abstract make_eval(**kwargs)
abstract make_test(**kwargs)
abstract make_test_local(**kwargs)
class colda.algorithm.strategy.abstract_algorithm_strategy.AbstractTrainAlgorithmStrategy

Bases: ABC

abstract classmethod get_instance()
abstract make_residual(**kwargs)
abstract make_result(**kwargs)
abstract make_train(**kwargs)
abstract make_train_local(**kwargs)

colda.algorithm.strategy.api module

class colda.algorithm.strategy.api.BaseAlgorithmStrategy

Bases: object

Base class for algorithm 1. Contains data processing for input and output 2. Contains shared stage:

make_hash make_match_idx

Methods

algorithm_process make_hash make_match_idx

final make_hash(**kwargs) list

Common stage algo Call MakeHash.make_hash to hash identifiers

Parameters

**kwargs : Any

Returns

list

final make_match_idx(**kwargs) list

Common stage algo Call MakeMatchIdx.make_match_idx to match the identifiers between sponsor and assistor

Parameters

**kwargs : Any

Returns

list

class colda.algorithm.strategy.api.TestAlgorithm

Bases: AbstractTestAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage test algorithm

Attributes

train_custom

Methods

get_instance make_test_local make_test make_eval

classmethod get_instance() TestAlgorithm

Singleton pattern. Get instance of current class.

Returns

TestAlgorithm

make_eval(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test_local(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

property test_custom

Get strategy object

Returns

Any

class colda.algorithm.strategy.api.TrainAlgorithm

Bases: AbstractTrainAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage train algorithm

Attributes

train_custom

Methods

get_instance make_train_local make_train make_result

classmethod get_instance() TrainAlgorithm

Singleton pattern. Get instance of current class.

Returns

type[TrainAlgorithm]

make_residual(**kwargs) None

strategy interface

make_result(**kwargs) None

strategy interface

make_train(**kwargs) None

strategy interface

make_train_local(**kwargs) None

strategy interface

property train_custom

Get strategy object

Returns

Any

colda.algorithm.strategy.base module

class colda.algorithm.strategy.base.BaseAlgorithmStrategy

Bases: object

Base class for algorithm 1. Contains data processing for input and output 2. Contains shared stage:

make_hash make_match_idx

Methods

algorithm_process make_hash make_match_idx

final make_hash(**kwargs) list

Common stage algo Call MakeHash.make_hash to hash identifiers

Parameters

**kwargs : Any

Returns

list

final make_match_idx(**kwargs) list

Common stage algo Call MakeMatchIdx.make_match_idx to match the identifiers between sponsor and assistor

Parameters

**kwargs : Any

Returns

list

colda.algorithm.strategy.dp module

class colda.algorithm.strategy.dp.DP

Bases: object

class for data processing

classmethod process_input(**kwargs)
classmethod process_input_recursion(data: Any)

Change list to np.array

classmethod process_output(res: tuple) dict | list | tuple | str | int | float | bool | None

Process the output that generated from all the algorithm methods.

All the output are tuple form. We first change the tuple to list form, then process the each element in the list

Parameters

res : tuple[Any]

Returns

Serializable_Datatype

colda.algorithm.strategy.test_algorithm module

class colda.algorithm.strategy.test_algorithm.TestAlgorithm

Bases: AbstractTestAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage test algorithm

Attributes

train_custom

Methods

get_instance make_test_local make_test make_eval

classmethod get_instance() TestAlgorithm

Singleton pattern. Get instance of current class.

Returns

TestAlgorithm

make_eval(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test_local(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

property test_custom

Get strategy object

Returns

Any

colda.algorithm.strategy.train_algorithm module

class colda.algorithm.strategy.train_algorithm.TrainAlgorithm

Bases: AbstractTrainAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage train algorithm

Attributes

train_custom

Methods

get_instance make_train_local make_train make_result

classmethod get_instance() TrainAlgorithm

Singleton pattern. Get instance of current class.

Returns

type[TrainAlgorithm]

make_residual(**kwargs) None

strategy interface

make_result(**kwargs) None

strategy interface

make_train(**kwargs) None

strategy interface

make_train_local(**kwargs) None

strategy interface

property train_custom

Get strategy object

Returns

Any

colda.algorithm.strategy.utils module

colda.algorithm.strategy.utils.algorithm_process(func: Callable) Callable
Wrapper that has following properties:

1. Process the input that pass into all the algorithm methods. Mainly change list to np.array 2. Process the output that generated from all the algorithm methods. Mainly change np.array to list

Parameters

func : Callable

Returns

JSONType

Module contents

class colda.algorithm.strategy.BaseAlgorithmStrategy

Bases: object

Base class for algorithm 1. Contains data processing for input and output 2. Contains shared stage:

make_hash make_match_idx

Methods

algorithm_process make_hash make_match_idx

final make_hash(**kwargs) list

Common stage algo Call MakeHash.make_hash to hash identifiers

Parameters

**kwargs : Any

Returns

list

final make_match_idx(**kwargs) list

Common stage algo Call MakeMatchIdx.make_match_idx to match the identifiers between sponsor and assistor

Parameters

**kwargs : Any

Returns

list

class colda.algorithm.strategy.TestAlgorithm

Bases: AbstractTestAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage test algorithm

Attributes

train_custom

Methods

get_instance make_test_local make_test make_eval

classmethod get_instance() TestAlgorithm

Singleton pattern. Get instance of current class.

Returns

TestAlgorithm

make_eval(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

make_test_local(**kwargs) list

call specific function

Parameters

**kwargs : Any

Returns

list

property test_custom

Get strategy object

Returns

Any

class colda.algorithm.strategy.TrainAlgorithm

Bases: AbstractTrainAlgorithmStrategy, BaseAlgorithmStrategy

Strategy pattern to manage train algorithm

Attributes

train_custom

Methods

get_instance make_train_local make_train make_result

classmethod get_instance() TrainAlgorithm

Singleton pattern. Get instance of current class.

Returns

type[TrainAlgorithm]

make_residual(**kwargs) None

strategy interface

make_result(**kwargs) None

strategy interface

make_train(**kwargs) None

strategy interface

make_train_local(**kwargs) None

strategy interface

property train_custom

Get strategy object

Returns

Any