Example #1
0
def auto_run_bencher(bencher, time=5, ave=True, vis=True):
    res = dict()
    for b in builder.builder_list.values():
        if bencher.rust and b.crate_version is None:
            continue
        if isinstance(b, builder.RustOnly) and not bencher.rust:
            continue
        print("running", bencher.__name__, "with", b.name)
        single = auto_run_single(bencher, b, time, ave or vis)
        res[b.name] = single
    if vis:
        visual.plot(bencher, res)
    return res
predicted_stock_price = scaler.inverse_transform(dataset_test_total)

# count of Wrong predicted value after applying treshold
err_cnt = error_count(predicted_stock_price[:, 0],
                      predicted_stock_price[:, 1],
                      toler_treshold=5.0)

# Calc difference between real data price and predicted price
diff_rate = calc_diff(predicted_stock_price[:, 0], predicted_stock_price[:, 1])
# show the inputs and predicted outputs
for i in range(len(predicted_stock_price[:, 1])):
    print("X=%s, Predicted=%s" %
          (predicted_stock_price[i, 1], predicted_stock_price[i, 0]))
print("Error count: ", err_cnt, "\n diff rate: ", diff_rate, "\n")
## Visualising the results
plot(predicted=predicted_stock_price[:, 1])
plot(real=predicted_stock_price[:, 0])
plot(predicted=predicted_stock_price[:, 1], real=predicted_stock_price[:, 0])

# MSE
mse = mean_squared_error(predicted_stock_price[:, 0], predicted_stock_price[:,
                                                                            1])
print("MSE: ", mse)

############ Visualizing the results ############
print("#############################################################")
# prin thn allagh, ola ta X_all kai y_all htan X kai y

inputs = np.array(X_all)
all_real_price = np.array(y_all)
print("all real price ", all_real_price, all_real_price.shape)
Example #3
0
del regressor

regressor = load_model('1.h5')

real_stock_price = np.array(X_test)
inputs = real_stock_price
predicted_stock_price = regressor.predict(inputs)

dataset_test_total = pd.DataFrame()
dataset_test_total['real'] = real_stock_price
dataset_test_total['predicted'] = predicted_stock_price
predicted_stock_price = scaler.inverse_transform(dataset_test_total) 


diff_rate = calc_diff(predicted_stock_price[:, 0], predicted_stock_price[:, 1])

inputs = np.array(X)

all_real_price = np.array(y)
all_predicted_price = regressor.predict(inputs)

dataset_pred_real = pd.DataFrame()
dataset_pred_real['real'] = all_real_price
dataset_pred_real['predicted'] = all_predicted_price

all_prices = scaler.inverse_transform(dataset_pred_real)  

plot(predicted=all_prices[:, 0])
plot(real=all_prices[:, 1])
plot(predicted=all_prices[:, 0], real=all_prices[:, 1])
Example #4
0
        new_date = {'value': random.randint(0, 100)}
        db.update(result[0], {"$set": new_date})  # 对查询到的第一条数据进行修改
        print('成功将:{} 修改成: {}'.format(result[0], new_date))
    except Exception as e:
        print(e)


if __name__ == '__main__':
    write()
    print('成功写入10w条随机数据!\n')

    insert()
    print()
    time.sleep(2)

    delete()
    print()
    time.sleep(2)

    result = search({'value': {'$gte': 0, '$lt': 10}})  # 查询条件 [0, 10)间的数据
    print('0-10间的数据有:\n', list(result))
    print()
    time.sleep(2)

    change()
    print()
    time.sleep(2)

    plot()