BaseClassifier (starclass.BaseClassifier)

class starclass.BaseClassifier(tset_key=None, features_cache=None, level='L1', plot=False)[source]

The basic stellar classifier class for the TASOC pipeline. All other specific stellar classification algorithms will inherit from BaseClassifier.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

__init__(tset_key=None, features_cache=None, level='L1', plot=False)[source]

Initialize the classifier object.

Parameters
  • tset_key (string) – From which training-set should the classifier be loaded?

  • level (string, optional) – Classfication-level to load. Coices are 'L1' and 'L2'. Default=’L1’.

  • features_cache (string, optional) – Path to director where calculated features will be saved/loaded as needed.

  • plot (boolean, optional) – Create plots as part of the output. Default is False.

plot

Indicates wheter plotting is enabled.

Type

boolean

data_dir

Path to directory where classifiers store auxiliary data. Different directories will be used for each classification level.

Type

string

calc_features(lightcurve)[source]

Calculate other derived features from the lightcurve.

classify(features)[source]

Classify a star from the lightcurve and other features.

Will run the do_classify() method and check some of the output and calculate various performance metrics.

Parameters

features (dict) – Dictionary of features, including the lightcurve itself.

Returns

Dictionary of classifications

Return type

dict

See also

do_classify()

Code author: Rasmus Handberg <rasmush@phys.au.dk>

close()[source]

Close the classifier.

do_classify(features)[source]

This method should be overwritten by child classes.

Parameters

features (dict) – Dictionary of features of star, including the lightcurve itself.

Returns

Dictionary where the keys should be from StellarClasses and the corresponding values indicate the probability of the star belonging to that class.

Return type

dict

Raises

NotImplementedError

load_star(task, fname)[source]

Recieve a task from the TaskManager, loads the lightcurve and returns derived features.

Parameters
  • task (dict) –

  • fname (string) –

Returns

Dictionary with features.

Return type

dict

See also

TaskManager.get_task()

Code author: Rasmus Handberg <rasmush@phys.au.dk>

parse_labels(labels)[source]

Convert iterator of labels into full numpy array, with only one label per star.

TODO: Make aware of self.level TODO: How do we handle multiple labels better?

test(tset, save=False, save_func=None)[source]

Test classifier using training-set, which has been created with a test-fraction.

Parameters
  • tset (TrainingSet object) – Training-set to run testing on.

  • save (boolean, optional) – Save results of test-predictions?

  • save_func (callable, optional) – Function to call for saving test-predictions.

train(tset)[source]
Parameters

tset (TrainingSet object) – Training-set to train classifier on.

Raises

NotImplementedError