Exemplo n.º 1
0
def train():
    data, _ = process_data.get_signal_values()
    Y = process_data.get_crack_lengths()

    X = metrics.fft_amp_sums(data)  #yes
    #X = metrics.correlation_coef(data)

    i = metrics.correlation_coef(data)  #yes
    X = metrics.concatenate_data(X, i)

    i = metrics.psd_height_sum(data)  #maybe
    X = metrics.concatenate_data(X, i)

    i = metrics.xc_mean_bin1(data)  #yes
    X = metrics.concatenate_data(X, i)

    X_train, Y_train, X_test, Y_test = process_data.remove_one_plate(X, Y)
    X_train, Y_train, X_test, Y_test = process_data.flatten_data(
        X_train, Y_train, X_test, Y_test)

    scaler = RobustScaler().fit(np.concatenate((X_train, X_test)))

    X_train = scaler.transform(X_train)
    X_test = scaler.transform(X_test)

    Y_train = np.array(Y_train)
    Y_test = np.array(Y_test)

    lin_reg.fit(X_train, Y_train, X_test, Y_test)
Exemplo n.º 2
0
def predict(model):
    X, Y = load_data()

    X_train, Y_train, X_test, Y_test = process_data.remove_one_plate(X, Y)
    X_train, Y_train, X_test, Y_test = process_data.flatten_data(
        X_train, Y_train, X_test, Y_test)

    Y_train = np.ravel(Y_train)
    Y_test = np.ravel(Y_test)

    model.predict(X_train, Y_train, X_test, Y_test)
Exemplo n.º 3
0
def train(model):    
    X, Y = load_data()

    X_train, Y_train , X_test, Y_test = process_data.remove_one_plate(X, Y)
    X_train, Y_train , X_test, Y_test = process_data.flatten_data(X_train, Y_train , X_test, Y_test)

    Y_train = categorize(Y_train)
    Y_test = categorize(Y_test)

    Y_train = np.ravel(Y_train)
    Y_test = np.ravel(Y_test)

    model.fit(X_train, Y_train, X_test, Y_test)
Exemplo n.º 4
0
def train(model):
    data, _ = process_data.get_signal_values()
    Y = process_data.get_crack_lengths()

    X = metrics.fft_amp_sums(data)  #yes
    #X = metrics.correlation_coef(data)

    # i = metrics.avg_peak_width(data) #no
    # X = metrics.concatenate_data(X, i)

    i = metrics.correlation_coef(data)  #yes
    X = metrics.concatenate_data(X, i)

    # i = metrics.fft_amp_max(data) #no
    # X = metrics.concatenate_data(X, i)

    i = metrics.psd_height_sum(data)  #maybe
    X = metrics.concatenate_data(X, i)

    i = metrics.xc_mean_bin1(data)  #yes
    X = metrics.concatenate_data(X, i)

    # i = metrics.psd_max_height(data)
    # X = metrics.concatenate_data(X, i)

    X_train, Y_train, X_test, Y_test = process_data.remove_one_plate(X, Y)
    X_train, Y_train, X_test, Y_test = process_data.flatten_data(
        X_train, Y_train, X_test, Y_test)

    scaler = RobustScaler().fit(np.concatenate((X_train, X_test)))

    X_train = scaler.transform(X_train)
    X_test = scaler.transform(X_test)

    Y_train = categorize(Y_train)
    Y_test = categorize(Y_test)

    model.fit(X_train, Y_train, X_test, Y_test)