def display_ij(self,n_dimensions,X_fs,X_val,Y_val,X_test,Y_test,i,j,classifieur_model): ACP = PCA(n_components=n_dimensions) ACP.fit(X_fs) X_valr = ACP.tranform(X_val) X_testr = ACP.transform(X_test) index_min = [min(X_valr[:,i].min(),X_testr[:,i].min()) - .5 for i in range(n_dimensions)] index_max = [max(X_valr[:,i].max(),X_testr[:,i].max()) + .5 for i in range(n_dimensions)] plt.figure(figsize=self.figsize) ax = plt.subplot(1,1,1) self.plotij(n_dimensions,i,j,ax,X_fs,X_val,X_valr,Y_val,X_test,X_testr,Y_test,ACP,index_min,index_max,classifieur_model) plt.show()
def getPredictedPriceNormalized(self): # get model first self.getModelFromFilePath(self, self.file) input_features = self.df.iloc[:, [2, 3]].values input_data = input_features predicted_value = self.model.predict(self.X_test) plt.figure(figsize=(100, 40)) plt.plot(predicted_value, color='red') plt.plot(input_data[self.lookback:self.test_size + (2 * self.lookback), 1], color='green') plt.title("Opening price of stocks sold") plt.xlabel("Time (latest-> oldest)") plt.ylabel("Stock Opening Price") plt.show() self.sc.inverse_transform(input_features[self.lookback:self.test_size + (2 * self.lookback)]) return predicted_value
def display_XY(self,n_dimensions,X_fs,X_val,Y_val,X_test,Y_test,classifieur_model): ACP = PCA(n_components=n_dimensions) ACP.fit(X_fs) X_valr = ACP.tranform(X_val) X_testr = ACP.transform(X_test) index_min = [min(X_valr[:,i].min(),X_testr[:,i].min()) - .5 for i in range(n_dimensions)] index_max = [max(X_valr[:,i].max(),X_testr[:,i].max()) + .5 for i in range(n_dimensions)] plt.figure(figsize=self.figsize) for i in range(n_dimensions - 1): for j in range(i + 1,n_dimensions): ax = plt.subplot(n_dimensions - 1,n_dimensions - 1,i + 1 + ((n_dimensions - 1) * (j - 1))) self.plotij(n_dimensions,i,j,ax,X_fs,X_val,Y_val,X_test,Y_test,ACP,index_min,index_max,classifieur_model) plt.tight_layout() plt.show()
def plot(self): try: self.config except NameError: sys.stdout.write('ERROR: No existing chain found. Please create the chain first.\n') import matplotlib.pyploy as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.add_subplots(111,projection='3d') if self.bind_atoms_config == None: ax.scatter(chain.config['x'].values, chain.config['y'].values, chain.config['z'].values, c='r') else: ax.scatter(chain.config['x'].values, chain.config['y'].values, chain.config['z'].values, c='r') ax.scatter(chain.bind_atoms_config['x'].values, chain.bind_atoms_config['y'].values, chain.bind_atoms_config['z'].values, c='b')
def plot_square_piece_simple(): """simple demo - makes more sense for a 'cut' to be the next level of abstraction after an 'edge' though""" pset = get_default_nub_parameters() pset.randomize() bxy, _ = create_puzzle_piece_edge(pset) pset.randomize() txy, _ = create_puzzle_piece_edge(pset) pset.randomize() lxy, _ = create_puzzle_piece_edge(pset) pset.randomize() rxy, _ = create_puzzle_piece_edge(pset) fig = plt.figure() fig.add_subplot(111, aspect='equal') plt.plot(bxy[:, 0], random_sign() * bxy[:, 1], 'k-') plt.plot(txy[:, 0], random_sign() * txy[:, 1] + 1, 'k-') plt.plot(random_sign() * lxy[:, 1], lxy[:, 0], 'k-') plt.plot(random_sign() * rxy[:, 1] + 1, rxy[:, 0], 'k-') plt.show()
for row in csv_file: try: high = int(row[4]) low = int(row[5]) current_date= datetime.strptime(row[2],'%Y-%m-%d') except ValueError: print(f"Missing data for {current_date}") else: lows.append(int(row[5])) highs.append(int(row[4])) dates.append(current_date) import matplotlib.pyploy as plt fig= plt.figure() plt.plot(dates, highs, c="red",alpha=0.5) plt.plot(dates, lows, c="blue", aplha=0.5) plt.title("Daily high and low temperatures- 2018\nDeath Valley", fontsize=16) plt.xlabel("", fontsize=12) plt.fill_between(dates, highs, lows, facecolor= 'blue', alpha=0.1) fig.autofmt_xdate() plt.ylabel("Temperature (F)", fontsize=16) plt.tick_params(axis="both", labelsize=16)