import math
import random

def       A__(		__lowerCAmelCase	,			__lowerCAmelCase = False ):
				if deriv:
								return value * (1 - value)
				return 1 / (1 + math.exp(-value ))


# Initial Value
lowercase_		:				Union[str, Any]				=						0.02

def       A__(		__lowerCAmelCase	,			__lowerCAmelCase ):
				_snake_case :			List[Any]  						=   float(2 * (random.randint(1	,			1_00 )) - 1 )

				for _ in range(__lowerCAmelCase ):
								# Forward propagation
								_snake_case :			Any  						=   sigmoid_function(INITIAL_VALUE * weight )
								# How much did we miss?
								_snake_case :			Dict  						=   (expected / 1_00) - layer_a
								# Error delta
								_snake_case :			Any  						=   layer_1_error * sigmoid_function(__lowerCAmelCase	,			__lowerCAmelCase )
								# Update weight
								weight += INITIAL_VALUE * layer_1_delta

				return layer_a * 1_00


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		lowercase_		:				Tuple				=						int(input('''Expected value: '''))
		lowercase_		:				List[str]				=						int(input('''Number of propagations: '''))
		print(forward_propagation(expected, number_propagations))













from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


lowercase_		:				Any				=						{
    '''configuration_canine''': ['''CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CanineConfig'''],
    '''tokenization_canine''': ['''CanineTokenizer'''],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_		:				Optional[Any]				=						[
		    '''CANINE_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''CanineForMultipleChoice''',
		    '''CanineForQuestionAnswering''',
		    '''CanineForSequenceClassification''',
		    '''CanineForTokenClassification''',
		    '''CanineLayer''',
		    '''CanineModel''',
		    '''CaninePreTrainedModel''',
		    '''load_tf_weights_in_canine''',
		]


if TYPE_CHECKING:
		from .configuration_canine import CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP, CanineConfig
		from .tokenization_canine import CanineTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_canine import (
				    CANINE_PRETRAINED_MODEL_ARCHIVE_LIST,
				    CanineForMultipleChoice,
				    CanineForQuestionAnswering,
				    CanineForSequenceClassification,
				    CanineForTokenClassification,
				    CanineLayer,
				    CanineModel,
				    CaninePreTrainedModel,
				    load_tf_weights_in_canine,
				)


else:
		import sys

		lowercase_		:				str				=						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






