diff --git a/etc/quiz-src/questions.txt b/etc/quiz-src/questions.txt new file mode 100644 index 00000000..7f5483e5 --- /dev/null +++ b/etc/quiz-src/questions.txt @@ -0,0 +1,135 @@ +Lesson 1B Introduction to AI - Pre Quiz +* A famous 19th century proto-computer engineer was +- Charles Barkley ++ Charles Babbage +- Charles Darwin +* Weak AI is a system designed to solve many tasks +- True ++ False +* Chat bots are an example of truly intelligent systems +- false, they are usually designed by a series of rules. +- true, they are usually considered to be 'intelligent ++ false, but they are increasingly able to pass Turing tests as they become more sophisticated. + +Lesson 1E Introduction to AI - Post-Quiz +* A top-down approach to AI is a model of reasoning called +- strategic reasoning ++ symbolic reasoning +- synergistic reasoning +* A bottom-up approach to AI is based on neural networks ++ True +- False +* The AI Winter occurred in this era +- 1950s +- 1960s ++ 1970s + +Lesson 2B Knowledge Representation and Expert Systems: Pre-Quiz +* The top-down approach to creating intelligent systems was based on: +- knowledge seeking and reading ++ knowledge representation and reasoning +- knowledge reasoning and seeking +* Knowledge is the same as information +- True ++ False +* Knowledge is obtained by an: ++ active learning process +- passive learning process +- both of these + +Lesson 2E Knowledge Representation and Expert Systems: Post-Quiz +* The simplest method of knowledge representation is: ++ algorithmic +- symbolic +- synergistic +* Scenarios can represent complex situations that can unfold in time ++ true +- false +* Forward inference starts with initial data and then: ++ executes a reasoning loop +- looks for a goal +- starts over + +Lesson 3B Introduction to Neural Networks - Perceptron: Pre-Quiz +* Early neural networks required ++ manual weight adjusting +- terabytes of data +- special reasoning +* A simple neuron is also called a 'threshold logic unit' ++ true +- false +* A perceptron is a ___ type of model +- multi-class classification +- clustering ++ binary classification + +Lesson 3E Introduction to Neural Networks - Perceptron: Post-Quiz +* To train a perceptron, find a weights vector that results in the smallest ___. +- size ++ error +- nodes +* To minimize the function of weights, you can use gradient descent ++ true +- false +* During gradient descent, each step updates the ___ +- learning rate ++ weights +- gradient + +Lesson 4B Neural Networks - Pre Quiz +* The quality of prediction is measured by Loss function ++ True +- False +* One layer network is capable of classifying ____ +- linearly joined classes ++ linearly separable classes +- single layers of classes +* The method of training multi-layered perceptron is called ____ ++ back propagation +- multiple propagation +- front propagation + +Lesson 4E Neural Networks - Post Quiz +* We use ____ for regression loss functions +- absolute error +- mean squared error ++ all of the above +* All but one is a type of classification loss function +- 0-1 loss ++ binary loss +- logistic loss +* Softmax can be used to convert inputs into probabilities +- True ++ False +* Cross-entropy loss is a function that can calculate similarity between two arbitrary probability distributions ++ True +- False + +Lesson 5B Frameworks - Pre Quiz +* Deep Neural Network training requires a lot of computations ++ True +- False +* Overfitting occurs because of ____ +- Not enough testing data ++ Too powerful model +- Too much noise in output data +* Bias errors are caused by our ____ not being able to capture the relationship between training data correctly. +- model ++ algorithm +- computer + +Lesson 5E Frameworks - Post Quiz +* After compiling our model object, we train by calling ____ function ++ fit +- train +- teach +* Binary cross-entropy is also called log loss ++ True +- False +* Tensorflow is to ____ while PyTorch is to ____ +- Facebook, Google ++ Google, Facebook +- Microsoft, Google +* Pred is the values predicted by the network ++ True +- False diff --git a/etc/quiz-src/qzmkjson.py b/etc/quiz-src/qzmkjson.py new file mode 100644 index 00000000..90fe6cb4 --- /dev/null +++ b/etc/quiz-src/qzmkjson.py @@ -0,0 +1,64 @@ +src = 'questions.txt' +dst_dir = '../quiz-app/src/assets/translations/zz' + +import json,os +from copy import deepcopy + +from matplotlib.cbook import ls_mapper + +def mk_id(s): # convert from 4B/4E to numeric lesson id + lesson_no = int(s[:-1]) + return lesson_no + (100 if s[-1]=='B' else 200) + +with open('template.json') as f: + doc = json.load(f) + +inp = open(src,encoding='utf-8').readlines() + +prev_q = None +prev_l = None +prev_l_id = None +lessons = { } + +for l in inp: + l = l.strip() + if l=='': continue + if l.startswith('+') or l.startswith('-'): # answer + prev_q['answerOptions'].append({ "answerText" : l[2:], "isCorrect" : l.startswith('+') }) + elif l.startswith('*'): + if prev_q: + prev_l['quiz'].append(prev_q) + prev_q = { "questionText" : l[2:], "answerOptions" : [] }; + elif l.startswith('Lesson'): + if prev_q: + prev_l['quiz'].append(prev_q) + prev_q = None + if prev_l is not None: + lessons[prev_l_id] = prev_l + prev_l_id = l[7:l.find(' ',7)] + prev_l = { "id" : mk_id(prev_l_id), "title" : l[l.find(' ',7)+1:], "quiz" : [] } + else: + print(f"Error: {l}") + +prev_l['quiz'].append(prev_q) +lessons[prev_l_id] = prev_l + +lesson_content = {} +for k,v in lessons.items(): + no = int(k[:-1]) + if no not in lesson_content.keys(): + lesson_content[no] = deepcopy(doc) + lesson_content[no][0]['quizzes'].append(v) + +print(lesson_content[1]) + +with open(os.path.join(dst_dir,'index.js'),'w',encoding='utf-8') as f: + for i,k in enumerate(lesson_content.keys()): + f.write(f'import x{k} from "./lesson-{k}.json";\n') + t = ', '.join([ f"{i} : x{k}[0]" for i,k in enumerate(lesson_content.keys())]); + f.write(f"const quiz = {{ {t} }}; \n"); + f.write("export default quiz;") + +for k,v in lesson_content.items(): + with open(os.path.join(dst_dir,f"lesson-{k}.json"),'w', encoding='utf-8') as f: + json.dump(v,f,indent=2) diff --git a/etc/quiz-src/template.json b/etc/quiz-src/template.json new file mode 100644 index 00000000..a6db6bbc --- /dev/null +++ b/etc/quiz-src/template.json @@ -0,0 +1,9 @@ +[ + { + "title": "AI for Beginners: Quizzes", + "complete": "Congratulations, you completed the quiz!", + "error": "Sorry, try again", + "quizzes": [ + ] + } +]