def testing_run_hardcoded_RBM_pass(self): self.rbms.append( rbm.RBM(NUM_DATAPOINTS, 3, visible_unit_type='gauss', model_name=self.name + "_layer_1", verbose=1, main_dir='layer_1_test')) self.rbms.append( rbm.RBM(3, 2, visible_unit_type='bin', model_name=self.name + '_layer_2', verbose=1, main_dir='layer_2_test')) training_set = pd.read_csv(TRAINING_SET_PATH, sep=',', header=None) training_set = training_set.values self.rbms[0].fit(training_set) test_set = pd.read_csv(TEST_SET_PATH, sep=',', header=None) test_set = test_set.values training_set_transform = self.rbms[0].transform(training_set) testing_tools.write_csv( training_set_transform, TESTING_PATH + '/L1_training_set_transformed.csv') self.rbms[1].fit(training_set_transform) x = self.rbms[1].transform(training_set_transform) testing_tools.write_csv( x, TESTING_PATH + '/L2_training_set_transformed_transformed.csv')
def test(self , dataset): init_op = tf.global_variables_initializer() with tf.Session() as sess: sess.run(init_op) #sess.run(self.testfunc , feed_dict={self.X:dataset}) #print(self.layer1_W) #x = (sess.run(self.layer3 , feed_dict={self.X:dataset}).shape) x = sess.run(self.layer3 , feed_dict={self.X:dataset}) testing_tools.write_csv(x , 'didthiswork.csv')
def testing_load_previous_and_transform(self): # Note - this doesn't work and i don't know why # load up our rbms[2] r = rbm.RBM(3, 2, visible_unit_type='bin', model_name=self.name + '_layer_2', verbose=1, main_dir='layer_2_test') r.load_model( [[3, 2], [22, 3]], 1, '/home/tyler/2018_Development/Fantasy_Stats_ML/layer_2_test/models/test1_layer_2' ) test_set = pd.read_csv( 'FFNN_Dev_Testing/L1_training_set_transformed.csv', sep=',', header=None) testing_tools.write_csv(r.transform(test_set), TESTING_PATH + '/Loaded_L2_transform.csv')
def save_RBM_data(self): for rbm in self.rbms: # the name of the folder we will write in rbm_dir = self.target_directory + rbm.model_name + '/' # get the rbm values values = rbm.get_model_parameters() # store 'W' testing_tools.write_csv(values['W'], rbm_dir + 'W.csv') testing_tools.write_csv(values['bh_'], rbm_dir + 'bh_.csv') testing_tools.write_csv(values['bv_'], rbm_dir + 'bv_.csv')
TEST_SET_PATH = "FormattedFantasyData/2018_data.csv" NUM_DATAPOINTS = 22 # import our training dataset into a dataframe, then immediately recast it to numpy array # this dataset contains fantasy stats for the past decate (excluding this current season) # and is numerical only # the data has 22 points of data for each player training_set = pd.read_csv(TRAINING_SET_PATH, sep=',', header=None) training_set = training_set.values # get our test set test_set = pd.read_csv(TEST_SET_PATH, sep=',', header=None) test_set = test_set.values # initialize RBM r = rbm.RBM(NUM_DATAPOINTS, 3, visible_unit_type='gauss', model_name="fantasy_position", verbose=1, main_dir='fantasy_test') # fit for training set r.fit(training_set) # see what this puppy thinks of the test set testing_tools.write_csv(r.transform(test_set), 'RBMTestingResults/2018_data_transform_first.csv') print("finished")
import rbm import pandas as pd import testing_tools as tt # import our data (numerical values only) df = pd.read_csv("nums_only.csv" , sep=',' , header=None) df = df.values # just recasts our dataframe as a numpy array without labels or column names etc r = rbm.RBM(27 , 2 , visible_unit_type='gauss', model_name="test_model" , verbose=1, main_dir='sametest') r.load_model([27,2] , 1, '/home/tyler/2018_Development/Fantasy_Stats_ML/sametest/models/test_model') print(r.get_model_parameters()) tt.write_csv(r.transform(df) , 'model_trained_data_transformed_2.csv')