Merge pull request #2 from microsoft/main

getting upstream changes
This commit is contained in:
Jen Looper 2022-04-29 17:19:51 -04:00 committed by GitHub
commit cddd0a552e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 2919 additions and 879 deletions

View File

@ -1,3 +1,4 @@
name: docs
on: [push]
@ -12,4 +13,4 @@ jobs:
github_token: ${{ secrets.GP_TOKEN }}
dir: etc/docsify
# destination branch
branch: "main"

View File

@ -58,7 +58,7 @@ Note that the left-most part of all those expressions is the same, and thus we c
<img alt="compute graph" src="images/ComputeGraphGrad.png"/>
> TODO: image citation
> Image by author
> ✅ We will cover backprop in much more detail in our notebook example.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,7 @@
import en1 from "./lesson-1.json";
import en2 from "./lesson-2.json";
import en3 from "./lesson-3.json";
const quiz = {
0: en1[0],
1: en2[0],
2: en3[0]
};
export default quiz;
import x1 from "./lesson-1.json";
import x2 from "./lesson-2.json";
import x3 from "./lesson-3.json";
import x4 from "./lesson-4.json";
import x5 from "./lesson-5.json";
const quiz = { 0 : x1[0], 1 : x2[0], 2 : x3[0], 3 : x4[0], 4 : x5[0] };
export default quiz;

View File

@ -5,7 +5,7 @@
"error": "Sorry, try again",
"quizzes": [
{
"id": 1,
"id": 101,
"title": "Introduction to AI - Pre Quiz",
"quiz": [
{
@ -13,15 +13,15 @@
"answerOptions": [
{
"answerText": "Charles Barkley",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "Charles Babbage",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "Charles Darwin",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -30,11 +30,11 @@
"answerOptions": [
{
"answerText": "True",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "False",
"isCorrect": "true"
"isCorrect": true
}
]
},
@ -43,51 +43,51 @@
"answerOptions": [
{
"answerText": "false, they are usually designed by a series of rules.",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "true, they are usually considered to be 'intelligent'.",
"isCorrect": "false"
"answerText": "true, they are usually considered to be 'intelligent",
"isCorrect": false
},
{
"answerText": "false, but they are increasingly able to pass Turing tests as they become more sophisticated.",
"isCorrect": "true"
"isCorrect": true
}
]
}
]
},
{
"id": 2,
"title": "Introduction to AI: Post-Quiz",
"id": 201,
"title": "Introduction to AI - Post-Quiz",
"quiz": [
{
"questionText": "A top-down approach to AI is a model of reasoning called",
"answerOptions": [
{
"answerText": "strategic reasoning",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "symbolic reasoning",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "synergistic reasoning",
"isCorrect": "false"
"isCorrect": false
}
]
},
{
"questionText": "A bottom-up approach to AI might leverage a neural network to",
"questionText": "A bottom-up approach to AI is based on neural networks",
"answerOptions": [
{
"answerText": "true",
"isCorrect": "true"
"answerText": "True",
"isCorrect": true
},
{
"answerText": "false",
"isCorrect": "false"
"answerText": "False",
"isCorrect": false
}
]
},
@ -96,15 +96,15 @@
"answerOptions": [
{
"answerText": "1950s",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "1960s",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "1970s",
"isCorrect": "true"
"isCorrect": true
}
]
}
@ -112,4 +112,4 @@
}
]
}
]
]

View File

@ -4,9 +4,8 @@
"complete": "Congratulations, you completed the quiz!",
"error": "Sorry, try again",
"quizzes": [
{
"id": 3,
"id": 102,
"title": "Knowledge Representation and Expert Systems: Pre-Quiz",
"quiz": [
{
@ -14,15 +13,15 @@
"answerOptions": [
{
"answerText": "knowledge seeking and reading",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "knowledge representation and reasoning",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "knowledge reasoning and seeking",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -30,12 +29,12 @@
"questionText": "Knowledge is the same as information",
"answerOptions": [
{
"answerText": "true",
"isCorrect": "false"
"answerText": "True",
"isCorrect": false
},
{
"answerText": "false",
"isCorrect": "true"
"answerText": "False",
"isCorrect": true
}
]
},
@ -44,22 +43,22 @@
"answerOptions": [
{
"answerText": "active learning process",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "passive learning process",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "both of these",
"isCorrect": "false"
"isCorrect": false
}
]
}
]
},
{
"id": 4,
"id": 202,
"title": "Knowledge Representation and Expert Systems: Post-Quiz",
"quiz": [
{
@ -67,15 +66,15 @@
"answerOptions": [
{
"answerText": "algorithmic",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "symbolic",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "synergistic",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -84,11 +83,11 @@
"answerOptions": [
{
"answerText": "true",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "false",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -97,15 +96,15 @@
"answerOptions": [
{
"answerText": "executes a reasoning loop",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "looks for a goal",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "starts over",
"isCorrect": "false"
"isCorrect": false
}
]
}
@ -113,4 +112,4 @@
}
]
}
]
]

View File

@ -4,25 +4,24 @@
"complete": "Congratulations, you completed the quiz!",
"error": "Sorry, try again",
"quizzes": [
{
"id": 5,
"title": "Introduction to Neural Networks - Perceptron: Post-Quiz",
"id": 103,
"title": "Introduction to Neural Networks - Perceptron: Pre-Quiz",
"quiz": [
{
"questionText": "Early neural networks required",
"answerOptions": [
{
"answerText": "manual weight adjusting",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "terabytes of data",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "special reasoning",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -31,11 +30,11 @@
"answerOptions": [
{
"answerText": "true",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "false",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -43,23 +42,23 @@
"questionText": "A perceptron is a ___ type of model",
"answerOptions": [
{
"answerText": "linear regression",
"isCorrect": "false"
"answerText": "multi-class classification",
"isCorrect": false
},
{
"answerText": "clustering",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "binary classification",
"isCorrect": "true"
"isCorrect": true
}
]
}
]
},
{
"id": 6,
"id": 203,
"title": "Introduction to Neural Networks - Perceptron: Post-Quiz",
"quiz": [
{
@ -67,15 +66,15 @@
"answerOptions": [
{
"answerText": "size",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "error",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "nodes",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -84,11 +83,11 @@
"answerOptions": [
{
"answerText": "true",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "false",
"isCorrect": "false"
"isCorrect": false
}
]
},
@ -97,15 +96,15 @@
"answerOptions": [
{
"answerText": "learning rate",
"isCorrect": "false"
"isCorrect": false
},
{
"answerText": "weights",
"isCorrect": "true"
"isCorrect": true
},
{
"answerText": "gradient",
"isCorrect": "false"
"isCorrect": false
}
]
}
@ -113,4 +112,4 @@
}
]
}
]
]

View File

@ -4,7 +4,125 @@
"complete": "Congratulations, you completed the quiz!",
"error": "Sorry, try again",
"quizzes": [
{
"id": 104,
"title": "Neural Networks - Pre Quiz",
"quiz": [
{
"questionText": "The quality of prediction is measured by Loss function",
"answerOptions": [
{
"answerText": "True",
"isCorrect": true
},
{
"answerText": "False",
"isCorrect": false
}
]
},
{
"questionText": "One layer network is capable of classifying ____",
"answerOptions": [
{
"answerText": "linearly joined classes",
"isCorrect": false
},
{
"answerText": "linearly separable classes",
"isCorrect": true
},
{
"answerText": "single layers of classes",
"isCorrect": false
}
]
},
{
"questionText": "The method of training multi-layered perceptron is called ____",
"answerOptions": [
{
"answerText": "back propagation",
"isCorrect": true
},
{
"answerText": "multiple propagation",
"isCorrect": false
},
{
"answerText": "front propagation",
"isCorrect": false
}
]
}
]
},
{
"id": 204,
"title": "Neural Networks - Post Quiz",
"quiz": [
{
"questionText": "We use ____ for regression loss functions",
"answerOptions": [
{
"answerText": "absolute error",
"isCorrect": false
},
{
"answerText": "mean squared error",
"isCorrect": false
},
{
"answerText": "all of the above",
"isCorrect": true
}
]
},
{
"questionText": "All but one is a type of classification loss function",
"answerOptions": [
{
"answerText": "0-1 loss",
"isCorrect": false
},
{
"answerText": "binary loss",
"isCorrect": true
},
{
"answerText": "logistic loss",
"isCorrect": false
}
]
},
{
"questionText": "Softmax can be used to convert inputs into probabilities",
"answerOptions": [
{
"answerText": "True",
"isCorrect": false
},
{
"answerText": "False",
"isCorrect": true
}
]
},
{
"questionText": "Cross-entropy loss is a function that can calculate similarity between two arbitrary probability distributions",
"answerOptions": [
{
"answerText": "True",
"isCorrect": true
},
{
"answerText": "False",
"isCorrect": false
}
]
}
]
}
]
}
]
]

View File

@ -0,0 +1,128 @@
[
{
"title": "AI for Beginners: Quizzes",
"complete": "Congratulations, you completed the quiz!",
"error": "Sorry, try again",
"quizzes": [
{
"id": 105,
"title": "Frameworks - Pre Quiz",
"quiz": [
{
"questionText": "Deep Neural Network training requires a lot of computations",
"answerOptions": [
{
"answerText": "True",
"isCorrect": true
},
{
"answerText": "False",
"isCorrect": false
}
]
},
{
"questionText": "Overfitting occurs because of ____",
"answerOptions": [
{
"answerText": "Not enough testing data",
"isCorrect": false
},
{
"answerText": "Too powerful model",
"isCorrect": true
},
{
"answerText": "Too much noise in output data",
"isCorrect": false
}
]
},
{
"questionText": "Bias errors are caused by our ____ not being able to capture the relationship between training data correctly.",
"answerOptions": [
{
"answerText": "model",
"isCorrect": false
},
{
"answerText": "algorithm",
"isCorrect": true
},
{
"answerText": "computer",
"isCorrect": false
}
]
}
]
},
{
"id": 205,
"title": "Frameworks - Post Quiz",
"quiz": [
{
"questionText": "After compiling our model object, we train by calling ____ function",
"answerOptions": [
{
"answerText": "fit",
"isCorrect": true
},
{
"answerText": "train",
"isCorrect": false
},
{
"answerText": "teach",
"isCorrect": false
}
]
},
{
"questionText": "Binary cross-entropy is also called log loss",
"answerOptions": [
{
"answerText": "True",
"isCorrect": true
},
{
"answerText": "False",
"isCorrect": false
}
]
},
{
"questionText": "Tensorflow is to ____ while PyTorch is to ____",
"answerOptions": [
{
"answerText": "Facebook, Google",
"isCorrect": false
},
{
"answerText": "Google, Facebook",
"isCorrect": true
},
{
"answerText": "Microsoft, Google",
"isCorrect": false
}
]
},
{
"questionText": "Pred is the values predicted by the network",
"answerOptions": [
{
"answerText": "True",
"isCorrect": true
},
{
"answerText": "False",
"isCorrect": false
}
]
}
]
}
]
}
]

View File

@ -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

62
etc/quiz-src/qzmkjson.py Normal file
View File

@ -0,0 +1,62 @@
src = 'questions-en.txt'
dst_dir = '../quiz-app/src/assets/translations/en'
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)
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)

View File

@ -0,0 +1,9 @@
[
{
"title": "AI for Beginners: Quizzes",
"complete": "Congratulations, you completed the quiz!",
"error": "Sorry, try again",
"quizzes": [
]
}
]

1
index.html Normal file
View File

@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=https://github.com/jlooper/AI-For-Beginners/tree/main/etc/docsify">