



import unittest

from knapsack import greedy_knapsack as kp


class      __lowerCAmelCase     (		unittest.TestCase      ):
					"""simple docstring"""






					def     _a							(     self					:       str					):






								"""simple docstring"""


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



					def     _a							(     self					:       Any					):






								"""simple docstring"""


								self.assertRaisesRegex(_snake_case				,					'max_weight must greater than zero.'					)



					def     _a							(     self					:       str					):






								"""simple docstring"""


								self.assertRaisesRegex(_snake_case				,					'Weight can not be negative.'					)



					def     _a							(     self					:       Optional[Any]					):






								"""simple docstring"""


								self.assertRaisesRegex(_snake_case				,					'Profit can not be negative.'					)



					def     _a							(     self					:       Dict					):






								"""simple docstring"""


								self.assertRaisesRegex(_snake_case				,					'max_weight must greater than zero.'					)



					def     _a							(     self					:       List[str]					):






								"""simple docstring"""


								self.assertRaisesRegex(
								    _snake_case				,					'The length of profit and weight must be same.'					)


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









import math
import random


def A						(       __UpperCamelCase ,	__UpperCamelCase = False					)						->      float:
			if deriv:
						return value * (1 - value)
			return 1 / (1 + math.exp(-value					))


# Initial Value
SCREAMING_SNAKE_CASE__       =      0.02


def A						(       __UpperCamelCase ,	__UpperCamelCase					)						->      float:
			A__       =    float(2 * (random.randint(1 ,	100					)) - 1					)

			for _ in range(__UpperCamelCase					):
						# Forward propagation
						A__       =    sigmoid_function(INITIAL_VALUE * weight					)
						# How much did we miss?
						A__       =    (expected / 100) - layer_a
						# Error delta
						A__       =    layer_1_error * sigmoid_function(__UpperCamelCase ,	__UpperCamelCase					)
						# Update weight
						weight += INITIAL_VALUE * layer_1_delta

			return layer_a * 100


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							SCREAMING_SNAKE_CASE__       =      int(input('''Expected value: '''))
							SCREAMING_SNAKE_CASE__       =      int(input('''Number of propagations: '''))
							print(forward_propagation(expected, number_propagations))




