Assignment 1.1.1: Classifying Experiments

Last updated: March 3rd, 20202020-03-03Project preview
In [3]:
import pandas as pd

Classifying Experiments

Again let's use the Toy Dataset:

In [4]:
toy_dataset = pd.read_csv('toy_dataset.csv')
toy_dataset.head()
Out[4]:
Number City Gender Age Income Illness
0 1 Dallas Male 41 40367.0 No
1 2 Dallas Male 54 45084.0 No
2 3 Dallas Male 42 52483.0 No
3 4 Dallas Male 40 40941.0 No
4 5 Dallas Male 46 50289.0 No

For the following experiments you will have to decide whether it is a random experiment or a deterministic one. You can either deduce it by reading the code or you can try running the experiment and seeing what happens!

How many times should you try an experiment to be confident it is deterministic?

Once yo have your answer, assign the string 'random' or 'deterministic' to the variable experiment_n_is (where n is the experiment number). The first one will be done as an example.

In [5]:
def experiment_1():
    person = toy_dataset.sample(1)
    if person['Gender'].values[0] == 'Male':
        return person['Income'].values[0]
    else:
        return person['Age'].values[0]
In [6]:
experiment_1_is = 'random'

--- How to assert the right answers? Should we do this with learn? Or import a different notebook with the answers?---

In [7]:
def experiment_2():
    person = toy_dataset.sample(1) 
    if person['Income'].values[0] < 35000:
        return person['Gender'].values[0]
    else:
        return 'Male'
In [8]:
experiment_2_is = 
  File "<ipython-input-8-9ebbe2632f4c>", line 1
    experiment_2_is =
                      ^
SyntaxError: invalid syntax
In [ ]:
def experiment_3():
    person = toy_dataset.sample(1) 
    if person['Gender'].values[0] == 'Male':
        return person['Gender'].values[0]
    else:
        return 'Male'
In [ ]:
experiment_3_is = 
In [ ]:
def experiment_4():
    person = toy_dataset.sample(1)
    
In [ ]:
 
In [ ]:
 
Notebooks AI
Notebooks AI Profile20060