Coverage for src/ensae_projects/hackathon/random_answers.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-07-20 04:37 +0200

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Generates random answers for challenges. 

5""" 

6import os 

7import numpy 

8import pandas 

9 

10 

11def random_answers_2020_images(): 

12 """ 

13 Generates random answers the deep learning challenge of 

14 hackathons :ref:`l-hackathon-2020`. 

15 """ 

16 name = os.path.join(os.path.split(__file__)[0], "labels_2020_random.csv") 

17 df = pandas.read_csv(name)[['file_name']] 

18 df['label'] = numpy.random.randint(low=0, high=2, size=(df.shape[0], )) 

19 df['score'] = numpy.random.random((df.shape[0], )) 

20 return df 

21 

22 

23def random_answers_2020_ml(): 

24 """ 

25 Generates random answers the machine learning challenge of 

26 hackathons :ref:`l-hackathon-2020`. 

27 """ 

28 df = pandas.DataFrame({"index": numpy.arange(473333)}) 

29 df['label'] = numpy.random.randint(low=0, high=2, size=(df.shape[0], )) 

30 df['score'] = numpy.random.random((df.shape[0], )) 

31 return df