コード例 #1
0
def main():

    #url = input("Enter the url of blog: ")

    app = UI.App()
    url = str(app.returnURL())

    print("URL = " + str(url) + "\n------")
    posts = ws.scrapeBlog(url)
    print("Scrapingok \n------")

    for post in posts:
        print("into the loop")
        filename = ws.scrapePost(post)

        #path = input("Enter the name of the file: ")
        #The League of Extraordinary Gentlemen – Akaash Preetham
        text = dr.readDoc(filename)

        #text = input("Enter text here at main: ")

        #sortedWords = wc.countWords(text)
        #for word in sortedWords:
        #    print(str(word[0]) + '-' + str(word[1]))

        #wordcount = wc.countWords(text)
        #dv.visualizeData(wordcount)
        dv.visualizeData(text, filename)
コード例 #2
0
def tweet_picture_week():
    week_visualization()
    with open("grow.png", "rb") as imagefile:
        imagedata = imagefile.read()
    t_upload = Twitter(domain='upload.twitter.com',
                       auth=OAuth(
                           token=getenv("twitter_token"),
                           token_secret=getenv("token_secret"),
                           consumer_key=getenv("twitter_consumer_key"),
                           consumer_secret=getenv("twitter_consumer_secrets")))
    id_img1 = t_upload.media.upload(media=imagedata)["media_id_string"]
    t.statuses.update(status=DataV.text_week(), media_ids=",".join([id_img1]))
コード例 #3
0
import DataVisualization

#Initialize data
years = [
    1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,
    1992, 1993
]
population = [
    5000, 5100, 5800, 6800, 6600, 6700, 6900, 7000, 7500, 8000, 8800, 10000,
    10982, 12000
]
#Draw line chart
dataVisualization = DataVisualization.DataVisualization(
    years, population, "Population", "Population", "Year")
dataVisualization.DrawLineChart()
コード例 #4
0
ファイル: SustainLine.py プロジェクト: ds282547/DLFinal
    interpolated_x2 = np.arange(0, pmobj.get_end_time(), 0.032)
    interpolated_y2 = f(interpolated_x2)

    plt.plot(interpolated_x2 , interpolated_y2)
    '''

    plt.show()

    exit()

    piano_roll = pmobj.get_piano_roll(fs=100)

    print(piano_roll.shape)

    dv.showPiano(piano_roll)

    piano_roll = get_piano_roll_mod(ins, fs=100)

    print(piano_roll.shape)

    dv.showPiano(piano_roll)

    print('Processing File Pair %d/%d Name:%s' % (index + 1, N, pair[1]))
    #(inputnp, times) = prepFunc.procWaveData(pair[1])

    #print("Input shape:{0}".format(inputnp.shape))

    #origin_bins = math.ceil(pmobj.get_end_time() * prepFunc.sr / 512)
    #mytimes = np.arange(0,origin_bins,dtype="float")*(0.032)
コード例 #5
0
ファイル: DNN_Vaildation.py プロジェクト: ds282547/DLFinal
        output = model.forward(inputTensor)

        print("Input shape:{0}".format(inputTensor.shape))
        print("Ground-truth shape:{0}".format(labelTensor.shape))
        print("Predict-label shape:{0}".format(output.shape))
        '''
        if usingThreshold:
            output = output > 0.5
            fscore = skm.f1_score(labelTensor.cpu().numpy(), output.cpu().detach().numpy(), average='samples')
            print(fscore)
            fscorelist.append(fscore)
        '''
        if usingThreshold:
            output = output > 0.5

        dv.showSongData2(inputNP, labelTensor, output)
        '''
        
        if pairIndex % plotEverySong == 0 and pairIndex > 0:
            plt.plot(losslist)
            plt.savefig(lossFiguresPath+'result_%d.png' % pairIndex)
        '''

        totalElapsedTime = time.time() - startTime
        print('Total training time : ' +
              time.strftime('%H:%M:%S', time.gmtime(totalElapsedTime)))

    plt.plot(fscorelist)
    plt.show()

    totalElapsedTime = time.time() - startTime
コード例 #6
0
        #dv.showSongData(inputNP, labelTensor, output)

        outputDNN = outputDNN > 0.5
        fscoreDNN = skm.f1_score(labelTensor.cpu().numpy(),
                                 outputDNN.cpu().detach().numpy(),
                                 average='samples')
        print("DNN Fscore %f.6" % fscoreDNN)

        outputRNN = outputRNN > 0.4
        fscoreRNN = skm.f1_score(labelTensor.cpu().numpy(),
                                 outputRNN.cpu().detach().numpy(),
                                 average='samples')
        print("RNN Fscore %f.6" % fscoreRNN)

        dv.showSongDataWithModels(inputNP, labelTensor, [outputDNN, outputRNN])
        '''

        if pairIndex % plotEverySong == 0 and pairIndex > 0:
            plt.plot(losslist)
            plt.savefig(lossFiguresPath+'result_%d.png' % pairIndex)
        '''

        totalElapsedTime = time.time() - startTime
        print('Total time : ' +
              time.strftime('%H:%M:%S', time.gmtime(totalElapsedTime)))

        break

    totalElapsedTime = time.time() - startTime
    print('Total time : ' +
コード例 #7
0
ファイル: run_example.py プロジェクト: nishi951/cvxbenchmarks
print("number of results:", str(len(framework.results)))

# Export results to a pandas panel
print("exporting results.")
results = framework.export_results_as_panel()
print(results.to_frame(filter_observations=False))

# Data Visualization
import matplotlib.pyplot as plt
import math

# Generate performance profiles for all solver configurations

# Graph performance profile:
plt.figure()
dv.plot_performance_profile(results)
plt.draw()

# Graph time vs. big(small)^2
plt.figure()
dv.plot_scatter_by_config(results, "max_big_small_squared", "solve_time")
plt.draw()

# Graph time vs. number of scalar variables
plt.figure()
dv.plot_scatter_by_config(results,
                          "num_scalar_variables",
                          "solve_time",
                          logx=True,
                          logy=True)
plt.draw()
コード例 #8
0
    try:
        print('Директория удалена')
        shutil.rmtree(img_dir)
    except:
        print('Директория не найдена')

    # создание директории для сохранения изображений
    os.makedirs(img_dir, exist_ok=True)

    # создается экземпляр класса обработки кадров
    # задаются параметры - число строк, число столбцов
    fp = FramesProcessing.FramesProcess(3, 15)

    # экземпляр класса для построения и отображения графиков
    vd = DataVisualization.VisualData()

    vd.set_config(300, 550, [0, 0, 0])  # параметры изображения графиков
    histo = vd.set_bgimage()  # "холст" для рисования графиков

    # ======================================================================
    limit_ignore = 20  # число игнорируемых кадров
    ignore_count = 0  # счетчик игнорируемых кадров
    cnt_image = 0  # счетчик сделаных снимков
    write_ok = False  # флаг разрешения записи файла
    framescnt = 0  # счетчик кадров
    old_array = [0]  # предыдущий массив
    new_array = [0]  # новый массив

    cap = cv2.VideoCapture(-1)
    cv2.namedWindow('histo')
コード例 #9
0
ファイル: Inference.py プロジェクト: ds282547/DLFinal
                CNN_output[i] = CNN_model.forward(CNN_inputTensor[i].unsqueeze(0))
        '''
        # loss = model.Loss(output, labelTensor)
        if useThreshold:
            # CNN_output = CNN_output > 0.5
            RNN_output = RNN_output > 0.5
            # DNN_output = DNN_output > 0.5

        # print("Input shape:{0}".format(inputTensor.shape))
        print("Ground-truth shape:{0}".format(labelTensor.shape))
        #print("Predict-label shape:{0}".format(output.shape))

        print(RNN_output[38032])
        exit()

        dv.showSongData3(inputNP, labelTensor,  RNN_output)

        # DNN_FScore.append(f1_score(labelTensor.detach().cpu().numpy(), DNN_output.detach().cpu().numpy(),average ='samples'))
        # CNN_FScore.append(f1_score(labelTensor.detach().cpu().numpy(), CNN_output.detach().cpu().numpy(),average ='samples'))
        # RNN_FScore.append(f1_score(labelTensor.detach().cpu().numpy(), RNN_output.detach().cpu().numpy(),average ='samples'))

        totalElapsedTime = time.time() - startTime
        print('Total training time : ' + time.strftime('%H:%M:%S', time.gmtime(totalElapsedTime)))
        # np.save("CNN_final", CNN_output.detach().cpu().numpy())
        # np.save("RNN_final", RNN_output.detach().cpu().numpy())
        # np.save("DNN_final", DNN_output.detach().cpu().numpy())
        # print(np.mean(DNN_FScore))
        print(np.mean(CNN_FScore))
        # print(np.mean(RNN_FScore))