예제 #1
0
## MULTIPLYING RETWEETS FOLLOWERS

print("multiplying nr. of retweet followers by sentiments.")
sentanalyzer = SentimentAnalyzer()
sentanalyzer.merge_tweets_with_retweets(coin)
#print(coin.tweets)
sentanalyzer.sent_mul_tweet_followers(coin)
sentanalyzer.sent_mul_retweet_followers(coin)

print(len(coin.retweets))
print(coin.retweets.tail())

## GROUPING RETWEETS BY HOUR

print("grouping retweets by hour basis")
sentanalyzer.group_retweet_by_hour(coin)
print(coin.grtdf.head())

print("grouping tweets by hour basis")
sentanalyzer.group_tweet_by_hour(coin)
print(coin.gtdf.tail())

## COIN PRICE
coinprice = CoinPrice()
coinprice.read_and_sort_price(coin)

print(coin.pricehourly.tail())

phase = "prepare2"
coin.save_to_storeage(phase)
예제 #2
0
                    'eu_market',
                    'us_market',
                    'day',
                    'max_datetime_x',
                    'max_datetime_y'
                ],
                inplace=True)

            #cointrain.add_log_columns(data,strCols=True)

            print(len(data))
            print('data.columns')
            print(data.columns)
            #print(data)
            coin.data_to_predict = data
            coin.save_to_storeage('train')

            #min_max_scaler = preprocessing.MinMaxScaler()
            #np_scaled = min_max_scaler.fit_transform(data)
            #data = pd.DataFrame(np_scaled)
            #coin.save_scaler(min_max_scaler)

            #cointrain.add_square_columns(data,strCols=False)


            def precision(y_true, y_pred):
                threshold = 0.55
                mult = 0.5 / threshold
                true_positives = K.sum(
                    K.round(K.clip(y_true * y_pred * mult, 0, 1)))
                predicted_positives = K.sum(