Skip to main content

Modular Neural Network Protyping for Stock Market Prediction

Project description

MLProto: Modular Prototyping Tool for LSTM Machine Learning Models

Usage

Video overview coming

The ProtoMake Script

The ProtoMake script combines the Proto and Data modules into one to create an easy, convenient, and modular neural network prototyping tool for LSTM machine learning models. The script will take the user's desired parameters and create, train, and evaluate a model fitting said parameters. This allows the user to quickly analyze model prototypes, make adjustments, and iterate on model designs.

Arguments

Positional:
    key ---- User's Alpha_Vantage API key
    identifier ---- Ticker symbols to create models for
    target ---- Column number of target values

Optional:
    -depth ---- number of layers to include in the neural network (def: 1)
    -node_counts ---- list of node counts for layers (len(node_counts) must equal depth)
    -batch ---- batch size of input data set (def: [100])
    -test_size ---- proportion of dataset to use as validation (def: .2)
    -loss ---- identifier string of keras-supported loss function to be used in training (def: mse)
    -learning_rate ---- learning rate to be used by the Adam optimizer
    -epochs ---- maximum number of epochs to train the model (def: 100)
    -model_in ---- file path of pre-made model to load
    --early_stop ---- flag deciding whether to apply early stopping (patience 5) to the training phase
    --plots ---- flag deciding whether to save loss, input, and prediction graphs
    --normalize ---- flag deciding whether or not to normalize input data

Usage Example

ProtoMake test.csv test_model --early_stop --plots

The above command will create, train, and evaluate a model for the data in test.csv. It saves a model test_model.h5 in directory ./models/ and input, loss, and prediction graphs in the directory ./plots/ for analysis.

The Proto Module

The Proto module contains the core functionality of the machine-learning portion of the package. It holds all of the model manipulation methods.

``` Python
from MLProto import *

""" Data operations (assign data, pred_data)
______________________________________________
"""

stkr = Proto('test', data)
stkr.train(25, True, True))
stkr.evaluate()
stkr.predict_data(pred_data)
```

The above code will take prepared data, create a Proto instance "test" for the data given, train for 25 epochs, save the model to the models folder as train.h5 and predict data points based on the user's prepared prediction data.

The Data module

This module includes the data operation helper functions used by MLProto.

single_step_data takes a full dataset and creates a timeseries dataset from it for input into an LSTM model.

Contributions

Please send pull requests! I am a full-time student, so development and support for MLProto will likely be slow with me working alone. I welcome any and all efforts to contribute!

License

GNU LGPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MLProto-0.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

MLProto-0.2.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file MLProto-0.2.0.tar.gz.

File metadata

  • Download URL: MLProto-0.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for MLProto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8e5f0c0f73a68e91aed1638905ee2d21293f41761558ead4b1171b8a1eb3f5c8
MD5 b7d6fc5951801c325617d19be3de2da4
BLAKE2b-256 004c25ce17b9df87d0ad5b8cb6ee919edd8c1a9ffa705851d1cf1cc7026dd8f5

See more details on using hashes here.

File details

Details for the file MLProto-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: MLProto-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for MLProto-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cbc8f6f4587111ca5a2bfc0a81edcda9c972b9d0db4ecfcef659cad3285e4dd
MD5 7706459562b0602284e369adbf2ff57d
BLAKE2b-256 13ec2b429072db2c0fc2657e40e9f65b258252987f0cc84527e0b9997373696b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page