Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hazarddede/machine-learning
Machine Learning sandbox
https://github.com/hazarddede/machine-learning
Last synced: about 7 hours ago
JSON representation
Machine Learning sandbox
- Host: GitHub
- URL: https://github.com/hazarddede/machine-learning
- Owner: HazardDede
- License: mit
- Created: 2019-11-16T11:15:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T21:37:46.000Z (almost 2 years ago)
- Last Synced: 2023-03-04T13:14:02.352Z (over 1 year ago)
- Language: Python
- Size: 679 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# machine-learning
> A machine learning / data science sandbox
## General
This package uses fire to run commands.
If you have any troubles you could always put `--help` at the end
of a command and see if the man page reveals any helpful information.## Classification
### Cats vs. Dogs (Microsft dataset)
Train a Convoluted neural network (tensorflow) to distinguish between cats and dogs.
```bash
python ml models classification animals train --project catsvsdogs
```To have a look at the tensorboard
```bash
tensorboard --logdir ./artifacts/catsvsdogs/tb_logs
```Use the previously trained model to classify the entire dataset and show the confusion matrix afterwards:
```bash
python ml models classification animals predict --project catsvsdogs
```### Digits (MNist)
Train a neural network (tensorflow) to classify digital numbers.
```bash
python ml models classification digits train --project digits
```To have a look at the tensorboard
```bash
tensorboard --logdir ./artifacts/digits/tb_logs
```Use the previously trained model to classify the entire dataset and show the confusion matrix afterwards:
```bash
python ml models classification digits predict --project digits
```## Reinforcement Learning
### Blackjack
Train a Q-Learning model to play blackjack!
First run baseline to determine how either fixed actions (always stick) or
random actions (random stick or draw a card) will perform:```bash
# Fixed action
python ml models rl blackjack baseline --episodes=200000 --project=blackjack-baseline-fixed --mode=fixed# Random action
python ml models rl blackjack baseline --episodes=200000 --project=blackjack-baseline-random --mode=random
```After that you can evaluate if your Q-Learning is actually better than the baseline:
```bash
# Notice: Blackjack seems to be more successful with lower gammas...
python ml models rl blackjack train --episodes=200000 --project=blackjack-qlearn --learning-rate=0.1 --gamma=0.1
```### Mountain car
Train a Q-Learning model to solve the mountain car game and be the king of the hill!
To train the Q-Learning model:
```bash
python ml models rl mountain train --episodes=10000 --project=mountain-car
```After that you can use the model to simulate the car to be king of the hill
```bash
python ml models rl mountain simulate ./artifacts/mountain-car/10000_qtable.pkl
```## Text
### Generic text classifier
A generic classifier for text categorization.
To train it on the default dataset by using TF-IDF Features and the SGD Classifer:
```bash
python ml models text generic train --tfidf --sgd --project bbcnews
```Now use the trained classifier to predict the categories for the whole dataset
and show the confusion matrix.```bash
python ml models text generic predict --project bbcnews
```You can ask the classifier itself for more help and how to enable / disable certain
feature engineering techniques and algorithms.```bash
python ml models text generic train --help
```