Coder Social home page Coder Social logo

forex-prediction's Introduction

How to use

install tensorflow_prediction

python setup.py install
import numpy as np
import tensorflow as tf
from tensorflow_prediction import forex_data, model as build_model

pred_length = 1

## generate training data
train_x, test_x, train_y, test_y = forex_data.gen_data("EURUSD", forex_data.m1_args, pred_length)

## build model
#pattern 1
model = build_model.build_model(build_model.dense_net, (120, 1), pred_length)
#pattern 2
model = build_model.dense_model
model_opt = model.init_conv_option
model.init_conv_option(128, (3, 6, 3))
mdoel = model.build_model((120, 1), pred_length)

## compile model
opt = tf.keras.optimizers.Adam(1e-3)
model.compile(opt, "mse", ["mae"])
train_callbacks = [
    tf.keras.callbacks.EarlyStopping(
        monitor="val_loss", patience=10,
        restore_best_weights=True
    ),
    tf.keras.callbacks.ReduceLROnPlateau(
        monitor="val_loss", factor=0.5,
        patience=2, verbose=1
    )
]

## training model
model.fit(train_x, train_y, 512, 100, validation_data=(test_x, test_y), callbacks=train_callbacks)

forex-prediction's People

Contributors

komo135 avatar

Stargazers

Mahmoud Sallem avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.