code: 
  
  
  
  
  
  
  import json
  import os
  import tempfile
  
  import datasets
  from datasets.arrow_writer import ArrowWriter
  from datasets.features import ArrayaD
  from utils import generate_examples, get_duration
  
  
  SCREAMING_SNAKE_CASE__		:       str   							=							(30, 4_87)
  SCREAMING_SNAKE_CASE__		:       Any   							=							(36, 10_24)
  SCREAMING_SNAKE_CASE__		:       List[Any]   							=							(1_00, 1_00)
  SCREAMING_SNAKE_CASE__		:       Any   							=							1_00
  
  SCREAMING_SNAKE_CASE__		:       int   							=							datasets.Features(
      {"""text""": ArrayaD(SHAPE_TEST_1, dtype="""float32"""), """image""": ArrayaD(SHAPE_TEST_2, dtype="""float32""")}
  )
  
  SCREAMING_SNAKE_CASE__							, SCREAMING_SNAKE_CASE__		:       Tuple   							=							os.path.split(__file__)
  SCREAMING_SNAKE_CASE__		:       List[Any]   							=							os.path.join(RESULTS_BASEPATH, """results""", RESULTS_FILENAME.replace(""".py""", """.json"""))
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase					)   -> Any:
  
       '''simple docstring'''
       with ArrowWriter(features=__lowerCamelCase   ,       path=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)					) as writer:
            for key, record in dummy_data:
                 UpperCAmelCase__			:     int										= my_features.encode_example(__lowerCamelCase					)
                 writer.write(__lowerCamelCase					)
            UpperCAmelCase__			,		UpperCAmelCase__			:     List[str]										= writer.finalize()
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> Optional[int]:
  
       '''simple docstring'''
       UpperCAmelCase__			:     Optional[Any]										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       for _ in dataset:
            pass
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> Dict:
  
       '''simple docstring'''
       UpperCAmelCase__			:     List[str]										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       dataset.set_format("""numpy"""					)
       for _ in dataset:
            pass
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> str:
  
       '''simple docstring'''
       UpperCAmelCase__			:     Optional[Any]										= 10
       UpperCAmelCase__			:     str										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       for i in range(0   ,       len(__lowerCamelCase					)   ,       __lowerCamelCase					):
            UpperCAmelCase__			:     str										= dataset[i : i + batch_size]
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> int:
  
       '''simple docstring'''
       UpperCAmelCase__			:     List[Any]										= 10
       UpperCAmelCase__			:     Tuple										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       dataset.set_format("""numpy"""					)
       for i in range(0   ,       len(__lowerCamelCase					)   ,       __lowerCamelCase					):
            UpperCAmelCase__			:     str										= dataset[i : i + batch_size]
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> List[Any]:
  
       '''simple docstring'''
       UpperCAmelCase__			:     Union[str, Any]										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       for col in feats:
            UpperCAmelCase__			:     Union[str, Any]										= dataset[col]
  
  
  
  
  
  @get_duration
  def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> List[Any]:
  
       '''simple docstring'''
       UpperCAmelCase__			:     Any										= datasets.Dataset.from_file(
           filename=os.path.join(__lowerCamelCase   ,       """beta.arrow"""					)   ,       info=datasets.DatasetInfo(features=__lowerCamelCase					)					)
       dataset.set_format("""numpy"""					)
       for col in feats:
            UpperCAmelCase__			:     Union[str, Any]										= dataset[col]
  
  
  
  
  
  def    _lowerCamelCase	(	)   -> str:
  
       '''simple docstring'''
       UpperCAmelCase__			:     Any										= {}
       UpperCAmelCase__			:     str										= (
           read_unformated,
           read_formatted_as_numpy,
           read_batch_unformated,
           read_batch_formatted_as_numpy,
           read_col_unformated,
           read_col_formatted_as_numpy,
       )
       with tempfile.TemporaryDirectory() as tmp_dir:
            UpperCAmelCase__			:     Optional[Any]										= datasets.Features({"""image""": ArrayaD(__lowerCamelCase   ,       dtype="""float32"""					)}					)
            UpperCAmelCase__			:     List[str]										= generate_examples(features=__lowerCamelCase   ,       num_examples=__lowerCamelCase					)
            UpperCAmelCase__			:     Optional[Any]										= write(__lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase					)
            for read_func in read_functions:
                 UpperCAmelCase__			:     Union[str, Any]										= read_func(__lowerCamelCase   ,       __lowerCamelCase					)
  
       with tempfile.TemporaryDirectory() as tmp_dir:
            # don't use fixed length for fair comparison
            # feats = datasets.Features(
            #     {"image": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), SPEED_TEST_SHAPE[1]), SPEED_TEST_SHAPE[0])}
            # )
            UpperCAmelCase__			:     List[Any]										= datasets.Features({"""image""": datasets.Sequence(datasets.Sequence(datasets.Value("""float32"""					)					)					)}					)
            UpperCAmelCase__			:     List[Any]										= generate_examples(
                features=__lowerCamelCase   ,       num_examples=__lowerCamelCase   ,       seq_shapes={"""image""": SPEED_TEST_SHAPE}					)
            UpperCAmelCase__			:     Dict										= write(__lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase					)
            for read_func in read_functions:
                 UpperCAmelCase__			:     Union[str, Any]										= read_func(__lowerCamelCase   ,       __lowerCamelCase					)
  
       with tempfile.TemporaryDirectory() as tmp_dir:
            # don't use fixed length for fair comparison
            # feats = datasets.Features(
            #     {"image": datasets.Sequence(datasets.Value("float32"), SPEED_TEST_SHAPE[0] * SPEED_TEST_SHAPE[1])}
            # )
            UpperCAmelCase__			:     Tuple										= datasets.Features({"""image""": datasets.Sequence(datasets.Value("""float32"""					)					)}					)
            UpperCAmelCase__			:     Any										= generate_examples(
                features=__lowerCamelCase   ,       num_examples=__lowerCamelCase   ,       seq_shapes={"""image""": [SPEED_TEST_SHAPE[0] * SPEED_TEST_SHAPE[1]]}   ,       )
            UpperCAmelCase__			:     Optional[int]										= write(__lowerCamelCase   ,       __lowerCamelCase   ,       __lowerCamelCase					)
            for read_func in read_functions:
                 UpperCAmelCase__			:     str										= read_func(__lowerCamelCase   ,       __lowerCamelCase					)
  
       with open(__lowerCamelCase   ,       """wb"""					) as f:
            f.write(json.dumps(__lowerCamelCase					).encode("""utf-8"""					)					)
  
  
  if __name__ == "__main__":  # useful to run the profiler
        benchmark_array_xd()
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  import random
  
  
  
  
  
  
  
  class 							UpperCAmelCase_     :
  
  
  
  
       def __init__(							self  ,	_lowerCAmelCase  ,	_lowerCAmelCase		):
            UpperCAmelCase__			:     Union[str, Any]										= x
            UpperCAmelCase__			:     Union[str, Any]										= y
  
  
  
  
       def      __UpperCAmelCase     (							self		):
            return (self.x**2 + self.y**2) <= 1
  
  
  
  
       @classmethod
       def      __UpperCAmelCase     (							cls		):
            return cls(x=random.random()  ,	y=random.random()		)
  
  
  
  
  
  def    _lowerCamelCase	(	__lowerCamelCase					)   -> float:
  
       '''simple docstring'''
       if number_of_simulations < 1:
            raise ValueError("""At least one simulation is necessary to estimate PI."""					)
  
       UpperCAmelCase__			:     Dict										= 0
       for _ in range(__lowerCamelCase					):
            UpperCAmelCase__			:     Union[str, Any]										= Point.random_unit_square()
  
            if random_point.is_in_unit_circle():
                 number_in_unit_circle += 1
  
       return 4 * number_in_unit_circle / number_of_simulations
  
  
  if __name__ == "__main__":
        # import doctest
  
        # doctest.testmod()
        from math import pi
  
        SCREAMING_SNAKE_CASE__		:       List[str]   							=							"""Please enter the desired number of Monte Carlo simulations: """
        SCREAMING_SNAKE_CASE__		:       int   							=							estimate_pi(int(input(prompt).strip()))
        print(f'''An estimate of PI is {my_pi} with an error of {abs(my_pi - pi)}''')
  
  
  
  
  
  
  