7.1 Question groups variation analysis tests


In [ ]:
%run "../Functions/7. Question groups variation analysis.ipynb"

In [ ]:
debugging = False

In [ ]:
if debugging:
    [x for x in demographicQuestions if not x in numericDemographicQuestions]
    for entryIndex in gfdf.index:
        try:
            for x in getNumeric(gfdf.loc[entryIndex], _source=correctAnswers + demographicAnswers):
                if type(x) != float:
                    print(entryIndex)
                break
        except Exception:
            print(entryIndex)
    #getNumeric(gfdf.iloc[0], _source=correctAnswers + demographicAnswers).apply(lambda x: print(type(x)))

In [ ]:
if debugging:
    for x in getNumeric(gfdf.loc['228'], _source=correctAnswers + demographicAnswers):
        if type(x) != float:
            print(type(x))
    gfdf.loc['208']

In [ ]:


In [ ]:


In [ ]:


In [ ]:
[x*100/125 for x in [42, 30, 34, 33, 26, 36, 65, 56]]

In [ ]:
# x is extreme opinion, y is moderate opinion
def ratioExtreme(x,y):
    return (x * 100)/(x + y)

In [ ]:
#Bio
ratioExtreme(8,14),ratioExtreme(10,20),ratioExtreme(10,44),ratioExtreme(12,41)

In [ ]:
#SB
ratioExtreme(14,19),ratioExtreme(16,22),ratioExtreme(8,33),ratioExtreme(10,36)

In [ ]:
#VG
ratioExtreme(5,19),ratioExtreme(8,20),ratioExtreme(42,42),ratioExtreme(46,30)

In [ ]:
#engineering
ratioExtreme(9,17),ratioExtreme(13,23),ratioExtreme(29,36),ratioExtreme(27,29)

In [ ]:
scientificQuestions

In [ ]:
gfdf = gfdfPlaytestPhase1PretestPosttestUniqueProfilesVolunteers.copy()
rmdf = rmdfPlaytestPhase1PretestPosttestUniqueProfilesVolunteers.copy()
allData = allDataPlaytestPhase1PretestPosttestUniqueProfilesVolunteers.copy()

In [ ]:
saveFiles = False

In [ ]:
baseGradingBase = (1,0,0,0)
lenientGradingBase = (3,2,1,0)
categoryLenientGradingBase = (2,2,1,0)
# This strict grading policy penalizes errors, and gives more points for "I don't know" answers than to errors.
strictGradingBase = (3,1,2,0)

In [ ]:
baseMisconceptionCoding = {
    0: "incorrect",
    1: "correct",
}
lenientMisconceptionCoding = {
    0: "severe misconception",
    1: "doesn't know",
    2: "mild misconception",
    3: "correct",
}
categoryLenientMisconceptionCoding = {
    0: "misconception",
    1: "doesn't know",
    2: "correct category"
}
strictMisconceptionCoding = {
    0: "severe misconception",
    1: "mild misconception",
    2: "doesn't know",
    3: "correct",
}

Per question analysis

Interest variation


In [ ]:
#QInterestBiology,\
QCuriosityBiology,\
QCuriositySyntheticBiology,\
QCuriosityEngineering,\
QCuriosityVideoGames,\
#QEnjoyed

In [ ]:
curiosityQuestions = [
    #QInterestBiology,\
    QCuriosityBiology,\
    QCuriositySyntheticBiology,\
    QCuriosityEngineering,\
    QCuriosityVideoGames,\
    #QEnjoyed,\
]
questions = [deltaPrefix + " " + q for q in curiosityQuestions]
questions

In [ ]:
plotPretestPosttestDeltaGfdf(allData, curiosityQuestions)

In [ ]:
for q in curiosityQuestions:
    analyseQuestion(allDataPlaytestPhase1PretestPosttestUniqueProfiles, q)

1-5 scale analysis


In [ ]:
# from dataFormating.ipynb
QCuriosityCoding = {"A lot": 4, "Beaucoup": 4, "Enormément": 5, "Énormément": 5, "Extremely": 5, "Moderately": 3, "Moyennement": 3, "Slightly": 2, "Un peu": 2, "I don't know": 3, "Je ne sais pas": 3, "Not at all": 1, "Pas du tout": 1}
QCuriosityBiologyCoding = QCuriosityCoding
QCuriositySyntheticBiologyCoding = QCuriosityCoding
QCuriosityEngineeringCoding = QCuriosityCoding
QCuriosityVideoGamesCoding = QCuriosityCoding
#biologyInterestCoding = {"A lot": 4, "Beaucoup": 4, "Enormément": 5, "Énormément": 5, "Extremely": 5, "Moderately": 3, "Moyennement": 3, "Slightly": 2, "Un peu": 2, "I don't know": 3, "Je ne sais pas": 3, "Not at all": 1, "Pas du tout": 1}
#QEnjoyedCoding = {'Extremely': 4, 'A lot': 3, 'Not at all': 0, 'A bit': 1, 'Moderately': 2, "No": 0, "Not applicable: not played yet": -1}

curiosityQuestionsCoding = [QCuriosityBiologyCoding, QCuriositySyntheticBiologyCoding, QCuriosityEngineeringCoding, QCuriosityVideoGamesCoding]

In [ ]:
gfdfResult = compareUsingCustomCorrection(
    gfdfPlaytestPhase1PretestPosttestUniqueProfiles,
    curiosityQuestions,
    curiosityQuestionsCoding,
)

In [ ]:
plotPretestPosttestDeltaGfdf(
    gfdfResult,
    curiosityQuestions,
    plotGraphs = True,
    printData = True,
    saveFiles = saveFiles,
    suffix = ' 1-5 score variation'
)

H2b Specific scientific questions

a)


In [ ]:
h2baQuestions = [QGenotypePhenotype]

In [ ]:
plotPretestPosttestDeltaGfdf(allData, h2baQuestions, qualitativeCoding = baseMisconceptionCoding)

In [ ]:
graphTitleStem = "genotype-phenotype question - "
analyseQuestionGroupParameters = [
    (getQGenotypePhenotypeGrading(*baseGradingBase),    graphTitleStem + "base grading", baseMisconceptionCoding),
    (getQGenotypePhenotypeGrading(*lenientGradingBase), graphTitleStem + "lenient grading", lenientMisconceptionCoding),
    (getQGenotypePhenotypeGrading(*strictGradingBase),  graphTitleStem + "strict grading", strictMisconceptionCoding),
]
for grading, title, coding in analyseQuestionGroupParameters:
    analyseQuestionGroup(
        gfdf,
        h2baQuestions,
        grading,
        title=title,
        plotGraphs = True,
        printData = True,
        saveFiles = saveFiles,
        qualitativeCoding = coding,
    )

c)


In [ ]:
h2bcQuestions = [
    #'What does this device do? RBS:PCONS:FLHDC:TER XXX', #32
    QDeviceRbsPconsFlhdcTer,
    #'What does this device do? PCONS:RBS:FLHDC:TER', #33
    QDevicePconsRbsFlhdcTer,
    #'What does this device do? PBAD:RBS:GFP:TER', #34
    QDevicePbadRbsGfpTer,
    #'What does this device do? PBAD:GFP:RBS:TER XXX', #35
    QDevicePbadGfpRbsTer,
    #'What does this device do? GFP:RBS:PCONS:TER XXX', #36
    QDeviceGfpRbsPconsTer,
    #'What does this device do? PCONS:GFP:RBS:TER XXX', #37
    QDevicePconsGfpRbsTer,
    #'What does this device do? AMPR:RBS:PCONS:TER XXX', #38
    QDeviceAmprRbsPconsTer,
    #'What does this device do? RBS:PCONS:AMPR:TER XXX', #39
    QDeviceRbsPconsAmprTer,
]

biobrick grammar analysis


In [ ]:
graphTitleStem = "device questions - "
analyseQuestionGroupParameters = [
    (getDeviceQuestionsGrading(*baseGradingBase),            graphTitleStem + "base grading"),
    (getDeviceQuestionsGrading(*categoryLenientGradingBase), graphTitleStem + "category lenient grading"),
    (getDeviceQuestionsGrading(*lenientGradingBase),         graphTitleStem + "lenient grading"),
    (getDeviceQuestionsGrading(*strictGradingBase),          graphTitleStem + "strict grading"),
]
for grading, title in analyseQuestionGroupParameters:
    analyseQuestionGroup(
        gfdf,
        h2bcQuestions,
        grading,
        title=title,
        plotGraphs = True, printData = True, saveFiles = saveFiles
    )

d)


In [ ]:
h2bdQuestions = [
    #'Represents the end of a device... TER', #20
    QBBFunctionTER,
    #'Represents the ability given... CDS', #22
    QBBFunctionGameCDS,
    #'Codes a protein... CDS', #24
    QBBFunctionBiologyCDS,
    #'Controls when the device is active... PR', #28
    QBBFunctionPR,
    #'Controls the level of expression, and thus how much the ability will be affected... RBS', #29
    QBBFunctionRBS,
]

In [ ]:
graphTitleStem = "biobrick function questions - "
analyseQuestionGroupParameters = [
    (getBioBrickFunctionsQuestionsGrading(*baseGradingBase),            graphTitleStem + "base grading"),
    (getBioBrickFunctionsQuestionsGrading(*categoryLenientGradingBase), graphTitleStem + "category lenient grading"),
    (getBioBrickFunctionsQuestionsGrading(*lenientGradingBase),         graphTitleStem + "lenient grading"),
    (getBioBrickFunctionsQuestionsGrading(*strictGradingBase),          graphTitleStem + "strict grading"),
]
for grading, title in analyseQuestionGroupParameters:
    analyseQuestionGroup(
        gfdf,
        h2bdQuestions,
        grading,
        title=title,
        plotGraphs = True, printData = True, saveFiles = saveFiles
    )

e)


In [ ]:
h2beQuestions = [
    #'What does this device do? RBS:PCONS:FLHDC:TER XXX', #32
    QDeviceRbsPconsFlhdcTer,
    #'What does this device do? PCONS:RBS:FLHDC:TER', #33
    QDevicePconsRbsFlhdcTer,
    #'What does this device do? GFP:RBS:PCONS:TER XXX', #36
    QDeviceGfpRbsPconsTer,
    #'What does this device do? PCONS:GFP:RBS:TER XXX', #37
    QDevicePconsGfpRbsTer,
    #'What does this device do? AMPR:RBS:PCONS:TER XXX', #38
    QDeviceAmprRbsPconsTer,
    #'What does this device do? RBS:PCONS:AMPR:TER XXX', #39
    QDeviceRbsPconsAmprTer,
    
    #'What does this device do? PBAD:RBS:GFP:TER', #34
    QDevicePbadRbsGfpTer,
    #'What does this device do? PBAD:GFP:RBS:TER XXX', #35
    QDevicePbadGfpRbsTer,
    #'What does this device do? GFP:RBS:PCONS:TER XXX', #36    
    
    #'Last question. Next page only contains remarks.Guess: you have crafted a functional device containing an arabinose-induced promoter and an arabinose Coding Sequence (CDS). What will happen?', #42
    QDevicePbadRbsAraTer,
]

h2beStricterQuestions = [
    
    #'What does this device do? PBAD:RBS:GFP:TER', #34
    QDevicePbadRbsGfpTer,
    #'What does this device do? PBAD:GFP:RBS:TER XXX', #35
    QDevicePbadGfpRbsTer,
    
    #'Last question. Next page only contains remarks.Guess: you have crafted a functional device containing an arabinose-induced promoter and an arabinose Coding Sequence (CDS). What will happen?', #42
    QDevicePbadRbsAraTer,
]

h2beStrictestQuestions = [ 
    
    #'Last question. Next page only contains remarks.Guess: you have crafted a functional device containing an arabinose-induced promoter and an arabinose Coding Sequence (CDS). What will happen?', #42
    QDevicePbadRbsAraTer,
]

In [ ]:
graphTitleStem1 = "broad-sense induction questions - "
graphTitleStem2 = "stricter-sense induction questions - "
graphTitleStem3 = "strictest-sense induction questions - "

analyseQuestionGroupParameters = [
    (h2beQuestions,
     getInductionQuestionsGrading(*baseGradingBase),
     graphTitleStem1 + "base grading",
     None,
    ),
    (h2beQuestions,
     getInductionQuestionsGrading(*lenientGradingBase),
     graphTitleStem1 + "lenient grading",
     None,
    ),
    (h2beQuestions,
     getInductionQuestionsGrading(*strictGradingBase),
     graphTitleStem1 + "strict grading" ,
     None,
    ),
]

analyseQuestionGroupParameters += [
    (h2beStricterQuestions,  
     getQuestionsGradingSubset(h2beQuestions, h2beStricterQuestions, analyseQuestionGroupParameters[0][1]),
     graphTitleStem2 + "base grading",
     None,
    ),
    (h2beStricterQuestions,
     getQuestionsGradingSubset(h2beQuestions, h2beStricterQuestions, analyseQuestionGroupParameters[1][1]),
     graphTitleStem2 + "lenient grading",
     None,
    ),
    (h2beStricterQuestions,
     getQuestionsGradingSubset(h2beQuestions, h2beStricterQuestions, analyseQuestionGroupParameters[2][1]),
     graphTitleStem2 + "strict grading",
     None,
    ),
    
    (h2beStrictestQuestions,
     getQuestionsGradingSubset(h2beQuestions, h2beStrictestQuestions, analyseQuestionGroupParameters[0][1]),
     graphTitleStem3 + "base grading",
     baseMisconceptionCoding,
    ),
    (h2beStrictestQuestions,
     getQuestionsGradingSubset(h2beQuestions, h2beStrictestQuestions, analyseQuestionGroupParameters[1][1]),
     graphTitleStem3 + "lenient grading",
     lenientMisconceptionCoding,
    ),
    (h2beStrictestQuestions,
     getQuestionsGradingSubset(h2beQuestions, h2beStrictestQuestions, analyseQuestionGroupParameters[2][1]),
     graphTitleStem3 + "strict grading",
     strictMisconceptionCoding,
    ),
]

for questions, grading, title, coding in analyseQuestionGroupParameters:
    analyseQuestionGroup(
        gfdf,
        questions,
        grading,
        title=title,
        plotGraphs = True,
        printData = True,
        saveFiles = saveFiles,
        qualitativeCoding = coding,
    )

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: