This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
const FlashCard = ({ question }) => { | |
const [isSelected, setSelected] = useState(false); | |
const handleClick = () => { | |
setSelected((s) => !s); | |
}; | |
const handleMouseLeave = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import FlashCard from "./FlashCard"; | |
const FlashCards = ({ questions }) => { | |
return ( | |
<div className="flashcards"> | |
{questions.map((question) => ( | |
<FlashCard question={question} key={question.id} /> | |
))} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is an implementation of the Hill Climbing algorithm for the MountainCar-v1 (Continuous Spaces) environment. | |
No gradient ascent is performed in this script. | |
""" | |
from typing import Callable, Dict, List, Any, Tuple, Optional | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yhat = MLJ.predict(tree, coerce(X[test, :], Continuous)) | |
# To calculate the log-loss or binary cross entropy of our classification algorithm | |
println("Log-Loss on the Test Set : $(log_loss(yhat, coerce(y[test], Multiclass)) |> mean)") | |
# To calculate the accuracy of our classification algorithm | |
println("Accuracy on the Test Set : $(accuracy(mode.(yhat), coerce(y[test], Multiclass)))") | |
# To generate the Confusion Matrix of our Classification algorithm | |
ConfusionMatrix()(mode.(yhat), coerce(y[test], Multiclass)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MLJ.fit!(tree, rows=train) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rng = StableRNG(42) | |
train, test = partition(eachindex(y), 0.85, shuffle=true, rng=rng); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tree = machine(tree_model, coerce(X, Continuous), coerce(y, Multiclass)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DecisionTreeClassifier = @load DecisionTreeClassifier pkg=DecisionTree | |
tree_model = DecisionTreeClassifier() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X, y = tfidf_mat, df[:, :Category] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = DocumentTermMatrix(crps) | |
tfidf_mat = tf_idf(m) |
NewerOlder