SLOSHClassifier (starclass.SLOSHClassifier
)
- class starclass.SLOSHClassifier(clfile='SLOSH_Classifier_Model.hdf5', mc_iterations=10, *args, **kwargs)[source]
Bases:
BaseClassifier
Solar-like Oscillation Shape Hunter (SLOSH) Classifier.
Code author: Marc Hon <mtyh555@uowmail.edu.au>
Code author: James Kuszlewicz <kuszlewicz@mps.mpg.de>
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- __init__(clfile='SLOSH_Classifier_Model.hdf5', mc_iterations=10, *args, **kwargs)[source]
Initialization for the class.
- Parameters:
saved_models – LIST of saved classifier filenames. Supports multi-classifier predictions.
- classify(task)
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
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- clear_model_list()[source]
Helper function to clear classifiers in the classifier list. :return: None
- close()
Close the classifier.
- do_classify(features)[source]
Prediction for a star, producing output determining if it is a solar-like oscillator.
- Parameters:
features (dict) – Dictionary of features. Of particular interest should be the lightcurve (
lightkurve.TessLightCurve
object) and powerspectum which contains the lightcurve and power density spectrum respectively.- Returns:
Dictionary of stellar classifications.
- Return type:
dict
- feature_importance_complete(tset=None, features=None, probs=None, diagnostics=None)
Function which will be called when feature importance is finishing.
- Parameters:
tset –
features –
probs –
diagnostics –
See also
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- load(infile)[source]
Loads a classifier model and adds it to the list of classifiers. :param infile: Path to trained model :return: None
- load_star(task)
Receive a task from the TaskManager, loads the lightcurve and returns derived features.
- Parameters:
task (dict) – Task dictionary as returned by
TaskManager.get_task()
.- Returns:
Dictionary with features.
- Return type:
dict
See also
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- parse_labels(labels)
Convert iterator of labels into full numpy array, with only one label per star.
TODO: How do we handle multiple labels better?
- save(outfile)[source]
Saves all loaded classifier models. :param outfile: Base output file name :return: None
- save_model(model, model_file)[source]
Saves out trained model : param model: trained model : param model_file: Output file name for model :return: None
- test(tset, save=None, feature_importance=False)
Test classifier using training-set, which has been created with a test-fraction.
- Parameters:
tset (
TrainingSet
) – Training-set to run testing on.save (callable, optional) – Function to call for saving test-predictions.
- test_complete(tset=None, features=None, probs=None, diagnostics=None)
Function which will be called when training is finishing.
- Parameters:
tset –
features –
probs –
diagnostics –
See also
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- train(tset)[source]
Trains a fresh classifier using a default NN architecture and parameters as of the Hon et al. (2018) paper.
- Parameters:
train_folder – The folder where training images are kept. These must be separated into subfolders by the image categories. For example: Train_Folder/1/ - Positive Detections; Train_Folder/0/ - Non-Detections
features (iterator of dicts) – Iterator of features-dictionaries similar to those in
do_classify()
.labels (iterator of lists) – For each feature, provides a list of the assigned known
StellarClasses
identifications.
- Returns:
A trained classifier model.
- Return type:
model
- property classifier_model
- property random_seed
Random seed used in derived classifiers.
- property random_state
Random state (
numpy.random.RandomState
) corresponding torandom_seed
.