def noiseImpactSearch(d,nSensor,nAnchor,sigmas,radiorange): graph.setLimit() for i in range(len(sigmas)): graph.setGraph() [posX,locX,disX,conX,noisyDisX,trueDisX,estPosX,cLevel] = problems.createProblem_random(d,nSensor,nAnchor,sigma,radiorange,0) multi.localizeByMultilateration(nSensor,nAnchor,locX,conX,estPosX,noisyDisX,cLevel,0,0) rmsd = helper.calcRMSD(nSensor,locX,posX,estPosX) graph.plotPoint2D(estPosX,"") print rmsd graph.show()
def generate(): #lines(path, 'a', xlabel='A setting', ylabel='hits', title="First cool graph") #bar(path, title='Second cool graph', ylabel='hits') options = {} dataset_lines(path, 'a', xlabel='a setting', ylabel='hits', title='a_evolution', **options) dataset_lines(path, 'b', xlabel='b setting', ylabel='hits', title='b_evolution', **options) dataset_lines(path, 'c', xlabel='c setting', ylabel='hits', title='c_evolution', **options) #adjust = {'top': 0.95, 'bottom': 0.15, 'right': 0.96, 'left': 0.1} #graph.save_figures(adjust=adjust, xscale=.7, yscale=.5) #graph.show(adjust=adjust, xscale=.7, yscale=.5) graph.show()
import graph from borders import country_border_graph from_verts = [] to_verts = [] for country in country_border_graph: for i in range(0, len(country_border_graph[country])): if country_border_graph[country][0] == '': # skip islands continue from_verts.append(country) to_verts.append(country_border_graph[country][i]) graph.show(from_verts, to_verts)
# Scatter A B def scatter_ab(): dot_a = ga.scatter(fpr_a[1],tpr_a[1],'A', 'o', colors[0]) dot_b = ga.scatter(fpr_b[1],tpr_b[1],'B', 'o', colors[1]) # Convex Hullfor A B C points = np.array([fpr_c,tpr_c]).T points = np.vstack((points,np.array([fpr_a[1],tpr_a[1]]))) points = np.vstack((points,np.array([fpr_b[1],tpr_b[1]]))) points = np.vstack((points,np.array([0,0]))) points = np.vstack((points,np.array([1,1]))) hull = ConvexHull(points) for simplex in hull.simplices: plt.plot(points[simplex, 0], points[simplex, 1], 'k-') ga.show() # plot connecting line of C # Scatter series of C for f,t, thres,color in zip(fpr_c,tpr_c,thresholds_c,colors): l = 'C: ' + str(thres) # plt.scatter(f,t,marker = '>', color = color, label = 'C: ' + str(thres)) ga.scatter(f,t,l,'>',color) scatter_ab() plt.plot(fpr_c,tpr_c) ga.show() # For c_threshold == 0.4 p = ca.check_threshold(c_value,0.4)
roc_curve = [] #for threshold, label in sorted(map(ThresholdAndLabel, samples), key = lambda x: x[0], reverse=True): for threshold, label in sorted(map(ThresholdAndLabel, samples), key = lambda x: x, reverse=True): roc_curve.append( label in known_labels ) graph.roc(roc_curve, label = title) pass plot_roc(threshold = density_threshold, samples = test_data, title= 'ROC for P(x|c) threshold') plot_roc(threshold = semi_threshold, samples = test_data, title= 'ROC for P(x|c)/P(x) threshold') graph.savefig('example1.pdf') graph.show() """Input space is small, so we can analyze it.""" def analyse(threshold, samples): for a in sorted(zip(map(threshold, samples), samples), reverse=True): print(a) inputs = list(set(unlabelled_data)) print('P(x|c) Threshold') analyse(density_threshold, inputs) print('P(x|c)/P(x) Threshold') analyse(semi_threshold, inputs)
import quandl_dump as qd import fracture import graph #('GOOGL', 'MSFT', 'TSLA', 'CSCO', 'TWTR', 'FB', 'GOOD', 'GLAD', 'FIX', 'NUE', 'XOMA','HELE') companies = qd.get_stored() for c in companies: result = fracture.get_point(c[1][['Adj. Close']]) print(c[0], result) if result: graph.show(c[0], c[1], result) # companies = qd.get_list("NASDAQ") # qd.dump(companies)
newGraph) # end timer end = time.time() # calculate total runtime runtime += (end - start) * 1000 # calculate average runtime runtime = runtime / numTrials # add them to the appropriate arrays x_values.append(n) y_values.append(runtime) return x_values, y_values xvalues = [10, 50, 100, 150, 200, 300, 400, 500, 700, 1000, 1200, 1400, 1600] x_axis, y_axis = runDijkstraTrials(dijkstra_helper, xvalues) x_axis2, y_axis2 = runAStarTrials(a_star_helper, xvalues) # plotting the graph graph.plot(x_axis, y_axis, "-.", color="blue", label="Dijkstra algorithm") graph.plot(x_axis2, y_axis2, "-", color="red", label="A Star Algorithm") # title and legend graph.title("Running times of Dijkstra's vs A* Algorithm") graph.legend() # x and y labels for the graph graph.xlabel("n") graph.ylabel("Time(ms)") graph.show()
# I love to play around with colors :) accent_color = '#c9c9c9' indicators_color = '#598720' # The use of normalized data is necessary for plotting the price and moving averages in the same graph. data['Close'] = data_n['Close'] data[ci.moving_average_1_label] = data_n[ci.moving_average_1_label] data[ci.moving_average_2_label] = data_n[ci.moving_average_2_label] # data['ATR'] = data_n['ATR'] # data['MACD'] = data_n['MACD'] # data['Stochastics'] = data_n['Stochastics'] # data['RSI'] = data_n['RSI'] # Draw draw(ticker, data[dataset_train_length:], predicted_data, ci, draw_moving_average_1=draw_moving_average_1, draw_moving_average_2=draw_moving_average_2, draw_ATR=draw_ATR, draw_MACD=draw_MACD, draw_Stochastics=draw_Stochastics, draw_RSI=draw_RSI, accent_color=accent_color, indicators_color=indicators_color) show() # save('graph.png')