astronomaly.frontend package

Submodules

astronomaly.frontend.interface module

class astronomaly.frontend.interface.Controller(pipeline_file)

Bases: object

clean_up()
delete_labels()

Allows the user to delete all the labels they’ve applied and start again

get_active_learning_columns()

Checks if active learning has been run and returns appropriate columns to use in plotting

get_coordinates(idx)

If available, will return the coordinates of the requested object in object format, ready to pass on to another website like simbad

Parameters:idx (str) – Index of the object
Returns:Coordinates
Return type:dict
get_data_type()
get_display_data(idx)

Simply calls the underlying Dataset’s function to return display data.

get_features(idx)

Returns the features of instance given by index idx.

get_max_id()
get_metadata(idx, exclude_keywords=[], include_keywords=[])

Returns the metadata for an instance in a format ready for display.

Parameters:
  • idx (str) – Index of the object
  • exclude_keywords (list, optional) – Any keywords to exclude being displayed
  • include_keywords (list, optional) – Any keywords that should be displayed
Returns:

Display-ready metadata

Return type:

dict

get_original_id_from_index(ind)

The frontend iterates through an ordered list that can change depending on the algorithm selected. This function returns the actual index of an instance (which might be ‘obj2487’ or simply ‘1’) when given an array index.

Parameters:ind (int) – The position in an array
Returns:The actual object id
Return type:str
get_visualisation_data(color_by_column='')

Returns the data for the visualisation plot in the correct json format.

Parameters:color_by_column (str, optional) – If given, the points on the plot will be coloured by this column so for instance, more anomalous objects are brighter. Current options are: ‘score’ (raw ML anomaly score), ‘trained_score’ (score after active learning) and ‘user_predicted_score’ (the regressed values of the human applied labels)
Returns:Formatting visualisation plot data
Return type:dict
randomise_ml_scores()

Returns the anomaly scores in a random order

run_active_learning()

Runs the selected active learning algorithm.

run_pipeline()

Runs (or reruns) the pipeline. Reimports the pipeline script so changes are reflected.

set_human_label(idx, label)

Sets the human-assigned score to an instance. Creates the column “human_label” if necessary in the anomaly_scores dataframe.

Parameters:
  • idx (str) – Index of instance
  • label (int) – Human-assigned label
set_pipeline_script(pipeline_file)

Allows the changing of the input pipeline file.

Parameters:pipeline_file (str) – New pipeline file
sort_ml_scores(column_to_sort_by='score')

Returns the anomaly scores sorted by a particular column.

astronomaly.frontend.run_server module

Module contents