lcc.stars_processing.tools package¶
Submodules¶
lcc.stars_processing.tools.params_estim module¶
-
class
lcc.stars_processing.tools.params_estim.
ParamsEstimator
(searched, others, descriptors, deciders, tuned_params, split_ratio=0.5, static_params={}, **kwargs)[source]¶ Bases:
object
Attributes
searched (list of Star objects) Searched stars others (list of Star objects) Contamination stars descriptors (list, iterable) Unconstructed descriptor objects deciders (list, iterable) Decider instances tuned_params (list of dicts) List of parameters to tune static_params (dict) Constant values for descriptors and deciders Methods
-
evaluate
(combination)[source]¶ Parameters: combination : dict
Dictionary of dictionaries - one per a descriptor.
- EXAMPLE
{‘AbbeValue’: {‘bin’:10, .. }, .. }
Returns: tuple
Stars filter, statistical values
-
evaluateCombinations
()[source]¶ Evaluate all combination of the filter parameters
Returns: list
Filters created from particular combinations
list
Statistical values of all combinations
list
Input parameters of all combinations
-
fit
(score_func=None, opt='max', save_params={})[source]¶ Find the best combination of the filter parameters
Parameters: score_func : function
Function which takes dict of statistical values and return a score
opt : str
- Option for evaluating scores
“max” - Returns the highest score “min” - Returns the lowerest score
save_params : dict
Parameters for saving outputs. For each output there are some mandatory keys:
- ROC plot:
“roc_plot_path” “roc_plot_name” “roc_plot_title” - optional
- ROC data file:
“roc_data_path” “roc_data_name” “roc_data_delim” - optional
- Statistical params of all combinations:
“stats_path” “stats_name” “stats_delim” - optional
Returns: object
Filter created from the best parameters
dict
Statistical values of the best combination
dict
Input parameters of the best combination
-
saveOutput
(save_params)[source]¶ Parameters: save_params : dict
Parameters for saving outputs. For each output there are some mandatory keys:
- ROC plot:
“roc_plot_path” “roc_plot_name” “roc_plot_title” - optional
- ROC data file:
“roc_data_path” “roc_data_name” “roc_data_delim” - optional
- Statistical params of all combinations:
“stats_path” “stats_name” “stats_delim” - optional
-
lcc.stars_processing.tools.stats_manager module¶
-
class
lcc.stars_processing.tools.stats_manager.
StatsManager
(stats)[source]¶ Bases:
object
Attributes
stats (list) List of dictionaries. They consists of statistical values. Or at least with “false_positive_rate” and “true_positive_rate” in order to work properly. Methods
-
plotROC
(save=False, title='ROC curve', path='.', file_name='roc_plot.png')[source]¶ Plot ROC and show it or save it
Parameters: save : bool
If True plot is saved into the file
title : str
Title of the plot
path : str
Path to the output file location
file_name : str
Name of the file
Returns: None
-
lcc.stars_processing.tools.visualization module¶
-
lcc.stars_processing.tools.visualization.
plot1DProbabSpace
(star_filter, plot_ranges, N, searched_coords=[], contaminatiom_coords=[])[source]¶ Plot probability space
Parameters: star_filter : StarsFilter object
Trained stars filter
plot_ranges : iterable
Ranges (max/min) for all axis
N : int
Number of points per axis
searched_coords : list, iterable
List of coordinates of searched objects
contaminatiom_coords : list, iterable
List of coordinates of contamination objects
Returns: tuple
x, y
-
lcc.stars_processing.tools.visualization.
plot2DProbabSpace
(star_filter, plot_ranges, N, searched_coords=[], contaminatiom_coords=[])[source]¶ Plot probability space
Parameters: star_filter : StarsFilter object
Trained stars filter
plot_ranges : iterable
Ranges (max/min) for all axis
N : int
Number of points per axis
searched_coords : list, iterable
List of coordinates of searched objects
contaminatiom_coords : list, iterable
List of coordinates of contamination objects
Returns: tuple
x, y, Z
-
lcc.stars_processing.tools.visualization.
plot2DUnsupProbabSpace
(coords, decider, opt='show', N=50)[source]¶
-
lcc.stars_processing.tools.visualization.
plotHist
(searched_coo, cont_coo, labels=[], bins=None, save_path=None, file_name='hist.png')[source]¶ Plot histogram
Parameters: searched_coo : iterable
Coordinates of searched objects to plot the histogram
cont_coo : iterable
Coordinates of contamination objects to plot the histogram
labels : list, tuple of str
Labels for axis
save_path : str, NoneType
Path to the folder where plots are saved if not None, else plots are showed immediately
bins : int, NoneType
Number of bins for histogram
file_name : str
Name of the plot file
Returns: None
-
lcc.stars_processing.tools.visualization.
plotProbabSpace
(star_filter, plot_ranges=None, opt='show', path='.', file_name='params_space.png', N=400, title='Params space', x_lab='', y_lab='', searched_coords=[], contamination_coords=[], OVERLAY=0.6)[source]¶ Plot params space
Parameters: star_filter : StarsFilter object
Trained stars filter object
plot_ranges : tuple, list
List of ranges. For example: [range(1,10), range(20,50)] - for 2D plot
opt : str
Option whether save/show/return
title : str
Title of the plot
path : str
Path to the output file location
file_name : str
Name of the file
OVERLAY : float
Percentage overlay of borders despite of data ranges
Returns: None