This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import os | |
train = pd.read_csv('train.csv') | |
landmarks = list(set(train['landmark_id'].tolist())) #use set to have only unique id's and turn it back to a list type again | |
#creates sub folders of landmark id in train and validation folder | |
train_folder = 'training_images' | |
validation_folder = 'validation_images' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.preprocessing.image import ImageDataGenerator | |
from keras.models import Sequential | |
from keras.layers import Conv2D, MaxPooling2D | |
from keras.layers import Activation, Dropout, Flatten, Dense | |
from keras import backend as K | |
from keras.callbacks import EarlyStopping | |
from keras.callbacks import ModelCheckpoint | |
# dimensions of our images. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node | |
> const models = require('./../models'); | |
sequelize deprecated String based operators are now deprecated. Please use Symbo | |
l based operators for better security, read more at http://docs.sequelizejs.com/ | |
manual/tutorial/querying.html#operators node_modules\sequelize\lib\sequelize.js: | |
242:13 | |
undefined | |
> Executing (default): CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER PRIMARY | |
KEY AUTOINCREMENT, `username` VARCHAR(255), `loggedIn` TINYINT(1), `createdAt` D | |
ATETIME NOT NULL, `updatedAt` DATETIME NOT NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node | |
> const models = require('../models'); | |
sequelize deprecated String based operators are now deprecated. Please use Symbo | |
l based operators for better security, read more at http://docs.sequelizejs.com/ | |
manual/tutorial/querying.html#operators node_modules\sequelize\lib\sequelize.js: | |
242:13 | |
undefined | |
> Executing (default): CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER PRIMARY | |
KEY AUTOINCREMENT, `username` VARCHAR(255), `loggedIn` TINYINT(1), `createdAt` D | |
ATETIME NOT NULL, `updatedAt` DATETIME NOT NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decider(row): | |
if row['Drop 7'] < row['Up 7'] and row['Mean Change 7'] > 0 and row['Change'] > 0: | |
return 0 #invest/hold or put in 100 investment if none | |
#Withdraw 50% | |
elif row['Drop 7'] < row['Up 7'] and row['Mean Change 7'] > 0 and row['Change'] < 0: | |
return -50 | |
#Withdraw 75% | |
elif row['Drop 7'] < row['Up 7'] and row['Mean Change 7'] < 0 or row['Change'] < 0: | |
return -75 | |
#invest 50% more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_drop(numbers): | |
return len([x for x in numbers if x < 0]) | |
def count_up(numbers): | |
return len([x for x in numbers if x > 0]) | |
df['Change'] = df['Value USD'] - df['Value 2'] | |
df.drop('Value 2', axis=1, inplace=True) | |
#Change for the past 7 days | |
df['Mean Change 7'] = df['Change'].rolling(7).mean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main_key = 0 | |
game_record = {} | |
##Add Reward Cycle last | |
def bitcoin_game(user_key=None, amount=1000, start_index=0, invest_amount=None, withdraw_amount=None): | |
global main_key, game_record | |
#print(user_key) | |
if user_key == None: | |
player_name = 'player_{0}'.format(main_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def player_1(start_index=0, miss_output=False, miss_plot=False, sleep=False, sleep_time=1, plot=False, output=True, hold_max=1000, withdraw_max=500, withdraw_min=10): | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(start_index=start_index) | |
prev_predict = day_info[-1] | |
miss_colors = ['g'] | |
while game_active == False: | |
#print(day_info[-1]) | |
if day_info[-1] == 0: #equilavent of 100 i.e. good odds | |
#print('first option') | |
if invested < 100: #invest 100 | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(user_key=user_key, invest_amount=withdraw_max/5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lazy_investor(start_index=0, output=False, plot=True, amount=1000): | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(start_index=start_index) | |
while game_active == False: | |
if amount > 100: | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(user_key=user_key, invest_amount=amount-100) | |
#print(bitcoin_game(user_key=user_key, invest_amount=amount-100)) | |
else: | |
try: | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(user_key=user_key) | |
except Exception as e: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def player_2(start_index=0, sleep=False, sleep_time=1, plot=False, output=True, miss_output=False, miss_plot=False, show_exception=True): | |
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(start_index=start_index) | |
peak_price = day_info[1] | |
min_price = day_info[4] | |
max_price = day_info[5] | |
mean_price = day_info[6] | |
invest = None | |
max_profit = invested |
OlderNewer