# Path: crowdastro/config.py
# SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
# def get(*args, **kwargs):


import argparse
import logging
import h5py
import numpy
import sklearn.externals.joblib
import sklearn.ensemble
import sklearn.kernel_approximation
import sklearn.linear_model
import sklearn.pipeline
import sklearn.preprocessing
import sklearn.svm
from .config import config
Matthew Alger
The Australian National University
2016
"""




PATCH_RADIUS = config['patch_radius']
PATCH_DIAMETER = PATCH_RADIUS * 2

def train(training_h5, classifier_out_path, astro_transformer_out_path,
          image_transformer_out_path, classifier='lr', use_astro=True,
          use_cnn=True, n_jobs=-1):
    """Trains logistic regression.

    training_h5: Training HDF5 file.
    classifier_out_path: Output classifier path.
    astro_transformer_out_path: Output astro transformer path.
    image_transformer_out_path: Output image transformer path.
    classifier: Classifier to use in {'lr', 'rf'}. Default 'lr'.
    use_astro: Use astronomical features. Default True.
    use_cnn: Use CNN features. Default True.
    n_jobs: Number of cores to use. Default all.
    -> classifier
    """
    if not any([use_astro, use_cnn]):
        raise ValueError('Must have features.')

    ir_survey = training_h5.attrs['ir_survey']

# Path: crowdastro/config.py
# SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
# def get(*args, **kwargs):


# Path: crowdastro/train.py
import argparse
import logging
import h5py
import numpy
import sklearn.externals.joblib
import sklearn.ensemble
import sklearn.kernel_approximation
import sklearn.linear_model
import sklearn.pipeline
import sklearn.preprocessing
import sklearn.svm
from .config import config

Matthew Alger
The Australian National University
2016
"""




PATCH_RADIUS = config['patch_radius']
PATCH_DIAMETER = PATCH_RADIUS * 2

def train(training_h5, classifier_out_path, astro_transformer_out_path,
          image_transformer_out_path, classifier='lr', use_astro=True,
          use_cnn=True, n_jobs=-1):
    """Trains logistic regression.

    training_h5: Training HDF5 file.
    classifier_out_path: Output classifier path.
    astro_transformer_out_path: Output astro transformer path.
    image_transformer_out_path: Output image transformer path.
    classifier: Classifier to use in {'lr', 'rf'}. Default 'lr'.
    use_astro: Use astronomical features. Default True.
    use_cnn: Use CNN features. Default True.
    n_jobs: Number of cores to use. Default all.
    -> classifier
    """
    if not any([use_astro, use_cnn]):
        raise ValueError('Must have features.')

    ir_survey = training_h5.attrs['ir_survey']

    n_static = config['surveys'][ir_survey]['n_features']