Esempio n. 1
0
def distribution_test(df: pd.DataFrame = pd.DataFrame()):
    if df.empty:
        df = filter(read())
    distribution.test_exp(df)
    distribution.test_gam(df)
    distribution.test_wei(df)
    distribution.test_logn(df)
    distribution.test_pare(df)
Esempio n. 2
0
def population_statistics(feature_description, data, treatment, target,
                          threshold, is_above, statistic_functions):
    """
    prints the results of the statistics functions on the target parameter based on a split of the data.

    the split is based on whether the treatment line in the data is higher then the threshold.
    note: filter_by_feature has been defined as filter,
    and print details has been defined as print_dt to reduce line length.
    :param feature_description: title
    :param data: the data for analysis
    :param treatment: the field to sort the data by threshold
    :param target: the field to be used for the statistic functions
    :param threshold: the threshold for sorting the data on treatment by
    :param is_above: decides if the data used is above threshold or not
    :param statistic_functions: the functions to analise the filtered target data by
    :return:
    """
    print_dt(
        filter(data, treatment,
               [x for x in data[treatment] if (x <= threshold) ^ is_above])[0],
        target, statistic_functions)
Esempio n. 3
0
import numpy as np
from models import GP3DModel, IRISplineModel, HybridModel, LogSpaceModel, LinearModel, ProductModel, DifferenceModel
from plot import Plot
import statsmodels.api as sm
from statsmodels.tools import add_constant

metric = sys.argv[1]
nowtime = None
if len(sys.argv) > 2:
    nowtime = dateutil.parser.parse(sys.argv[2])
else:
    nowtime = dt.datetime.now(timezone.utc)

df = data.get_data()
df = data.filter(df,
                 max_age=dt.datetime.now() - dt.timedelta(minutes=60),
                 required_metrics=[metric],
                 min_confidence=0.01)

irimodel = IRISplineModel("/iri.latest")
irimodel.train(metric)

irimodel_orig = irimodel

if len(df) == 0:
    model = irimodel
else:
    pred = irimodel.predict(df['station.longitude'].values,
                            df['station.latitude'].values)
    error = pred - df[metric].values
    print(df[metric].values)
    print(pred)
Esempio n. 4
0
def main():
    df = normalize(filter(read()))
    print('Running normality tests...')
    normality_test(df)
    print('Running distribution tests...')
    distribution_test(df)
Esempio n. 5
0
def normality_test(df: pd.DataFrame = pd.DataFrame()):
    if df.empty:
        df = filter(read())
    normality.test_and(df)
    normality.test_ks(df)
    normality.test_sh(df)
Esempio n. 6
0
        if event.type == pygame.QUIT:
            running = False

        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_q:
                running = False
            #if event.key == pygame.K_LEFT:
            #   engine.keyEvent = "L"
            #if event.key == pygame.K_RIGHT:
            #   engine.keyEvent = "R"
            if event.key == pygame.K_SPACE:
                pause = (not pause)
                engine.keyEvent = "SPACE"

    wave = filter(2)
    prediction = Classifier(wave)[-1]
    #prediction = predict([wave])

    if prediction == "L":
        engine.keyEvent = "L"

    elif prediction == "R":
        engine.keyEvent = "R"

    display.fill([0, 0, 0])

    if pause:
        engine.draw(display)
        engine.drawPause(display)
        pygame.display.update()