コード例 #1
0
 def display_history_graph(self, historyDict, numberOfEpochs):
     print(numberOfEpochs)
     if numberOfEpochs is not None:
         xAxis = list(range(0, numberOfEpochs))
         core.add_line_series(self.plotName, "Dokladnosc", xAxis,
                              historyDict.history['accuracy'])
         print(historyDict.history['accuracy'])
         core.add_line_series(self.plotName, "Strata", xAxis,
                              historyDict.history['loss'])
         print(historyDict.history['loss'])
コード例 #2
0
    def display_history_graph(self, historyDict, numberOfEpochs):

        with simple.window(self.learningGraph, width=300, height=300):
            core.add_separator()
            core.add_plot(self.historyPlotName)
            xAxis = range(0, numberOfEpochs)
            core.add_line_series(self.historyPlotName, "Dokładnosc", xAxis,
                                 historyDict['accuracy'])
            core.add_line_series(self.historyPlotName, "Strata", xAxis,
                                 historyDict['loss'])
コード例 #3
0
ファイル: main.py プロジェクト: AryanAb/StockV
def create(sender, data):
    core.set_value("company_id",
                   "{} Model Created".format(model_company.split('_')[0]))
    core.clear_plot("Pred")
    predict, original = data
    core.add_line_series("Pred",
                         "Prediction",
                         predict.index.tolist(),
                         predict[0].tolist(),
                         color=[255, 50, 50, 100])
コード例 #4
0
ファイル: gui.py プロジェクト: AryanAb/StockV
def create_model(sender, data):
    predict, original = model.create_model(model_company)
    print(predict.index)
    print(predict[0])
    print(type(predict.index))
    print(type(predict[0]))
    core.add_line_series("Pred",
                         "Prediction",
                         predict.index.tolist(),
                         predict[0].tolist(),
                         color=[255, 50, 50, 100])
コード例 #5
0
ファイル: chart.py プロジェクト: IlmastMaksim/ot-harjoitustyo
 def __init__(self, label):
     self.data = []
     self.labels = []
     self.plot_label = "##" + label
     self.chart = lambda: core.add_line_series(
         self.plot_label,
         label,
         y=self.data,
         x=self.labels,
         weight=2,
         color=[0, 0, 255, 100],
     )
コード例 #6
0
ファイル: gui.py プロジェクト: AryanAb/StockV
def plot_callback(sender, data):

    if data == "clear":
        selected_companies.clear()
    elif data != None:
        if data not in selected_companies:
            selected_companies.append(data)
        else:
            selected_companies.remove(data)

    core.clear_plot("Plot")
    cap_callback(None, selected_cap)

    for i in range(0, len(selected_companies)):
        company = selected_companies[i]
        stocks = pd.read_csv("dataset/" + company)

        data_x = list(range(1, len(stocks.index) + 1))
        data_y = stocks['High'].tolist()
        core.add_line_series("Plot",
                             company.split('_')[0],
                             data_x,
                             data_y,
                             color=colors[i % len(colors)])
コード例 #7
0
ファイル: gui.py プロジェクト: AryanAb/StockV
def cap_callback(sender, data):
    global selected_cap
    selected_cap = data
    core.clear_plot("Cap")

    for i in range(0, len(selected_companies)):
        company = selected_companies[i]
        stocks = pd.read_csv("dataset/" + company, parse_dates=['Date'])
        stocks['Date'] = pd.to_datetime(stocks['Date'],
                                        unit='D',
                                        errors='coerce')

        if data == "daily":
            data_x = list(range(1, len(stocks.index) + 1))
            data_y = (stocks['High'] * stocks['Volume']).tolist()
            core.add_line_series("Cap",
                                 company.split('_')[0],
                                 data_x,
                                 data_y,
                                 color=colors[i % len(colors)])

            core.add_line_series("Cap",
                                 "large-cap", [data_x[0], data_x[-1]],
                                 [10000000000, 10000000000],
                                 weight=3,
                                 color=[255, 50, 50, 100])
            core.add_line_series("Cap",
                                 "mid-cap", [data_x[0], data_x[-1]],
                                 [2000000000, 2000000000],
                                 weight=3,
                                 color=[200, 50, 50, 100])
            core.add_line_series("Cap",
                                 "small-cap", [data_x[0], data_x[-1]],
                                 [300000000, 300000000],
                                 weight=3,
                                 color=[150, 50, 50, 100])
        elif data == "monthly":
            monthly_stocks = stocks.groupby(pd.Grouper(key="Date",
                                                       freq='1M')).mean()
            data_x = list(range(1, len(monthly_stocks.index) + 1))
            data_y = (monthly_stocks['High'] *
                      monthly_stocks['Volume']).tolist()

            core.add_line_series("Cap",
                                 company.split('_')[0],
                                 data_x,
                                 data_y,
                                 color=colors[i % len(colors)])

            core.add_line_series("Cap",
                                 "large-cap", [data_x[0], data_x[-1]],
                                 [10000000000, 10000000000],
                                 weight=3,
                                 color=[255, 50, 50, 100])
            core.add_line_series("Cap",
                                 "mid-cap", [data_x[0], data_x[-1]],
                                 [2000000000, 2000000000],
                                 weight=3,
                                 color=[200, 50, 50, 100])
            core.add_line_series("Cap",
                                 "small-cap", [data_x[0], data_x[-1]],
                                 [300000000, 300000000],
                                 weight=3,
                                 color=[150, 50, 50, 100])
        elif data == "quarterly":
            quarterly_stocks = stocks.groupby(pd.Grouper(key="Date",
                                                         freq='3M')).mean()
            data_x = list(range(1, len(quarterly_stocks.index) + 1))
            data_y = (quarterly_stocks['High'] *
                      quarterly_stocks['Volume']).tolist()

            core.add_line_series("Cap",
                                 company.split('_')[0],
                                 data_x,
                                 data_y,
                                 color=colors[i % len(colors)])

            core.add_line_series("Cap",
                                 "large-cap", [data_x[0], data_x[-1]],
                                 [10000000000, 10000000000],
                                 weight=3,
                                 color=[255, 50, 50, 100])
            core.add_line_series("Cap",
                                 "mid-cap", [data_x[0], data_x[-1]],
                                 [2000000000, 2000000000],
                                 weight=3,
                                 color=[200, 50, 50, 100])
            core.add_line_series("Cap",
                                 "small-cap", [data_x[0], data_x[-1]],
                                 [300000000, 300000000],
                                 weight=3,
                                 color=[150, 50, 50, 100])
        elif data == "yearly":
            yearly_stocks = stocks.groupby(pd.Grouper(key="Date",
                                                      freq='1Y')).mean()
            data_x = list(range(1, len(yearly_stocks.index) + 1))
            data_y = (yearly_stocks['High'] * yearly_stocks['Volume']).tolist()

            core.add_line_series("Cap",
                                 company.split('_')[0],
                                 data_x,
                                 data_y,
                                 color=colors[i % len(colors)])

            core.add_line_series("Cap",
                                 "large-cap", [data_x[0], data_x[-1]],
                                 [10000000000, 10000000000],
                                 weight=3,
                                 color=[255, 50, 50, 100])
            core.add_line_series("Cap",
                                 "mid-cap", [data_x[0], data_x[-1]],
                                 [2000000000, 2000000000],
                                 weight=3,
                                 color=[200, 50, 50, 100])
            core.add_line_series("Cap",
                                 "small-cap", [data_x[0], data_x[-1]],
                                 [300000000, 300000000],
                                 weight=3,
                                 color=[150, 50, 50, 100])