def individual_feature_analysis(self,data,chosenFeature): """ Compute a group by on the chosenFeature and call featuresBarPlot to plot the result """ print "chosen feature: ",self.features[chosenFeature] featuresMeans = data.groupby(['video_category_id'])[self.features[chosenFeature]].mean() featuresNames = [self.Catagory_mapping[x] for x in featuresMeans.index] dataplotter.featuresBarPlot(featuresNames,featuresMeans.values)
def individual_feature_analysis(self, data, chosenFeature): """ Compute a group by on the chosenFeature and call featuresBarPlot to plot the result """ try: print "chosen feature: ", self.features[chosenFeature] featuresMeans = data.groupby(['video_category_id'])[self.features[chosenFeature]].mean() featuresNames = [self.Catagory_mapping[x] for x in featuresMeans.index] name = "../YoutubeData/FeatureBarChart.pdf" plt.savefig(name) print "\nPlease close the Bar Chart when you want to move ahead..." dataplotter.featuresBarPlot(featuresNames, featuresMeans.values) print "You can always retrieve the Feature Importance bar chart in YoutubeData folder.\n" time.sleep(3) return True except: raise VideoAnalysisException(" Error while performing individual feature analysis ")
def generalAnalysis(self, data, clf): """ Perform general analysis """ try: dataplotter.plotFeatureImportance(data, clf) dataplotter.plotNumericalCorrelationMatrix(data) dataplotter.plotGraphicalCorrelationMatrix(data) return True except: raise VideoAnalysisException(" Error while performing general analysis ")
#!/usr/bin/python # -*- coding: utf-8 -*- import DataPlotter file1 = "B1VandCy3ebbed1.dat" file2 = "PVC.pvc" #dreader = DataPlotter.DataReader(scheme='simplecsv') #dreader.setDialectByExampleFile(file1) #print "Delimiter: '" + dreader.Dialect.delimiter +"'" #dso = dreader.readFile(file1) ## ##dreader = DataPlotter.RsDataReader(scheme='pvc') ##dso = dreader.readFile(file2) ##print len(dso.Data) ##print len(dso.Data[0]) ##print len(dso.Data[1]) ##print dso.Data[0][0:10] ##print dso.Data[1][0:10] ##print dso.Data[1][-10:-1] ##print dso.Data[0][-10:-1] dplotter = DataPlotter.RsDataPlotter(scheme='pvc') dplotter.Plottitle = 'My test' filelist = ['PVC.pvc', 'PVC2.pvc'] dplotter.plotfiles(filelist) print("\nTest script completed.")
def plotter(self,master): DataPlotter(iff_com = self.do_ifeffit, master=master, plot_opts= self.plot_opts)
def generalAnalysis(self,data,clf): dataplotter.plotFeatureImportance(data,clf) dataplotter.plotCorrelationMatrix(data)
mail = IMAP4_SSL(self.server) mail.login(self.user_id, self.password) mail.select(folder) # retrieving the uids interval = (date.today() - timedelta(numberOfDays)).strftime("%d-%b-%Y") result, data = mail.uid('search', None,'(SENTSINCE {date})'.format(date=interval)) # retrieving the headers result, data = mail.uid('fetch', data[0].replace(' ',','),'(BODY[HEADER.FIELDS (DATE)])') mail.close() mail.logout() return data def parseConfigFile(self, CONFIG_FILE): config = ConfigParser.ConfigParser() config.read(CONFIG_FILE) return config def getValue(self, config, group, key): return config.get(group, key) if __name__ == "__main__": print 'Fetching emails...' mail = MailFetcher() headers = mail.getHeaders('inbox',5) print 'Plotting some statistics...' xday,ytime = dp.diurnalPlot(headers) dp.dailyDistributioPlot(ytime) print len(xday),'Emails analysed.' show()
def create_data_plot(self): self.dataplotter = DataPlotter.DataPlotter() self.stats = self.dataplotter.process_filedata(self.output_file_path) self.init_ui_page_four() self.ui.next()