





"""simple docstring"""

import unittest

from knapsack import greedy_knapsack as kp


class       lowerCAmelCase__				(   unittest.TestCase  ):







 def  lowercase_       (   self					):

    '''simple docstring'''


    A__											=					[10, 20, 30, 40, 50, 60]
    A__											=					[2, 4, 6, 8, 10, 12]
    A__											=					1_00
    self.assertEqual(kp.calc_profit(_lowerCamelCase		,	_lowerCamelCase		,	_lowerCamelCase					)		,	2_10					)







 def  lowercase_       (   self					):

    '''simple docstring'''


    self.assertRaisesRegex(_lowerCamelCase		,	"max_weight must greater than zero."					)







 def  lowercase_       (   self					):

    '''simple docstring'''


    self.assertRaisesRegex(_lowerCamelCase		,	"Weight can not be negative."					)







 def  lowercase_       (   self					):

    '''simple docstring'''


    self.assertRaisesRegex(_lowerCamelCase		,	"Profit can not be negative."					)







 def  lowercase_       (   self					):

    '''simple docstring'''


    self.assertRaisesRegex(_lowerCamelCase		,	"max_weight must greater than zero."					)







 def  lowercase_       (   self					):

    '''simple docstring'''


    self.assertRaisesRegex(
        _lowerCamelCase		,	"The length of profit and weight must be same."					)


if __name__ == "__main__":
 unittest.main()

"""simple docstring"""






import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.layers import LSTM, Dense
from tensorflow.keras.models import Sequential

if __name__ == "__main__":
					_lowercase							=				pd.read_csv('''sample_data.csv''', header=None)
					_lowercase							=				df.shape[:1][0]
					# If you're using some other dataset input the target column
					_lowercase							=				df.iloc[:, 1:2]
					_lowercase							=				actual_data.values.reshape(len_data, 1)
					_lowercase							=				MinMaxScaler().fit_transform(actual_data)
					_lowercase							=				10
					_lowercase							=				5
					_lowercase							=				20
					_lowercase							=				len_data - periods * look_back
					_lowercase							=				actual_data[:division]
					_lowercase							=				actual_data[division - look_back :]
					_lowercase			,       _lowercase							=				[], []
					_lowercase			,       _lowercase							=				[], []

					for i in range(0, len(train_data) - forward_days - look_back + 1):
										train_x.append(train_data[i : i + look_back])
										train_y.append(train_data[i + look_back : i + look_back + forward_days])
					for i in range(0, len(test_data) - forward_days - look_back + 1):
										test_x.append(test_data[i : i + look_back])
										test_y.append(test_data[i + look_back : i + look_back + forward_days])
					_lowercase							=				np.array(train_x)
					_lowercase							=				np.array(test_x)
					_lowercase							=				np.array([list(i.ravel()) for i in train_y])
					_lowercase							=				np.array([list(i.ravel()) for i in test_y])

					_lowercase							=				Sequential()
					model.add(LSTM(128, input_shape=(look_back, 1), return_sequences=True))
					model.add(LSTM(64, input_shape=(128, 1)))
					model.add(Dense(forward_days))
					model.compile(loss='''mean_squared_error''', optimizer='''adam''')
					_lowercase							=				model.fit(
					    x_train, y_train, epochs=150, verbose=1, shuffle=True, batch_size=4
					)
					_lowercase							=				model.predict(x_test)





