markdown stringlengths 0 1.02M | code stringlengths 0 832k | output stringlengths 0 1.02M | license stringlengths 3 36 | path stringlengths 6 265 | repo_name stringlengths 6 127 |
|---|---|---|---|---|---|
Load PyTorch modelIn this tutorial, you learn how to load an existing PyTorch model and use it to run a prediction task.We will run the inference in DJL way with [example](https://pytorch.org/hub/pytorch_vision_resnet/) on the pytorch official website. PreparationThis tutorial requires the installation of Java Kernel.... | // %mavenRepo snapshots https://oss.sonatype.org/content/repositories/snapshots/
%maven ai.djl:api:0.4.0
%maven ai.djl:repository:0.4.0
%maven ai.djl.pytorch:pytorch-engine:0.4.0
%maven org.slf4j:slf4j-api:1.7.26
%maven org.slf4j:slf4j-simple:1.7.26
%maven net.java.dev.jna:jna:5.3.0
// See https://github.com/... | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Step 1: Prepare your modelThis tutorial assumes that you have a TorchScript model.DJL only supports the TorchScript format for loading models from PyTorch, so other models will need to be [converted](https://github.com/awslabs/djl/blob/master/docs/pytorch/how_to_convert_your_model_to_torchscript.md).A TorchScript mod... | DownloadUtils.download("https://djl-ai.s3.amazonaws.com/mlrepo/model/cv/image_classification/ai/djl/pytorch/resnet/0.0.1/traced_resnet18.pt.gz", "build/pytorch_models/resnet18/resnet18.pt", new ProgressBar()); | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
In order to do image classification, you will also need the synset.txt which stores the classification class labels. We will need the synset containing the Imagenet labels with which resnet18 was originally trained. | DownloadUtils.download("https://djl-ai.s3.amazonaws.com/mlrepo/model/cv/image_classification/ai/djl/pytorch/synset.txt", "build/pytorch_models/resnet18/synset.txt", new ProgressBar()); | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Step 2: Create a TranslatorWe will create a transformation pipeline which maps the transforms shown in the [PyTorch example](https://pytorch.org/hub/pytorch_vision_resnet/).```python...preprocess = transforms.Compose([ transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.No... | Pipeline pipeline = new Pipeline();
pipeline.add(new Resize(256))
.add(new CenterCrop(224, 224))
.add(new ToTensor())
.add(new Normalize(
new float[] {0.485f, 0.456f, 0.406f},
new float[] {0.229f, 0.224f, 0.225f}));
Translator<BufferedImage, Classifications> translator =... | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Step 3: Load your modelNext, we will set the model zoo location to the `build/pytorch_models` directory we saved the model to. You can also create your own [`Repository`](https://javadoc.djl.ai/repository/0.4.0/index.html?ai/djl/repository/Repository.html) to avoid manually managing files.Next, we add some search crit... | // Search for models in the build/pytorch_models folder
System.setProperty("ai.djl.repository.zoo.location", "build/pytorch_models");
Criteria<BufferedImage, Classifications> criteria = Criteria.builder()
.setTypes(BufferedImage.class, Classifications.class)
// only search the model in local directory... | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Step 4: Load image for classificationWe will use a sample dog image to run our prediction on. | var img = BufferedImageUtils.fromUrl("https://github.com/pytorch/hub/raw/master/dog.jpg");
img | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Step 5: Run inferenceLastly, we will need to create a predictor using our model and translator. Once we have a predictor, we simply need to call the predict method on our test image. | Predictor<BufferedImage, Classifications> predictor = model.newPredictor();
Classifications classifications = predictor.predict(img);
classifications | _____no_output_____ | Apache-2.0 | jupyter/load_pytorch_model.ipynb | sreev/djl |
Occupation Introduction:Special thanks to: https://github.com/justmarkham for sharing the dataset and materials. Step 1. Import the necessary libraries | import pandas as pd | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user). Step 3. Assign it to a variable called users. | url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user'
users = pd.read_csv(url, sep = '|', index_col = 'user_id',)
users.head(5) | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 3.1) Check the columns | users.columns.ravel() | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 4. Discover what is the mean age per occupation | users.groupby('occupation')[['age']].mean() | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 5. Discover the Male ratio per occupation and sort it from the most to the least | # users.groupby(['occupation','gender'])[['user_id']].count()
temp = users.groupby(['occupation','gender'])['user_id'].count()
(temp.loc[temp.index.get_level_values('gender')=='M'] / users.groupby('occupation')['user_id'].count()).sort_values(ascending=False) | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 6. For each occupation, calculate the minimum and maximum ages | users.groupby('occupation')[['age']].min()
users.groupby('occupation')[['age']].max() | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 7. For each combination of occupation and gender, calculate the mean age | users.groupby(['occupation','gender']).age.agg(['mean','max','min']) | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Step 8. For each occupation present the percentage of women and men | temp = users.groupby(['occupation', 'gender']).agg({'gender':'count'})
temp1 = users.groupby('occupation').agg({'gender':'count'})
temp['ratio'] = temp / temp1
temp
# # create a data frame and apply count to gender
# gender_ocup = users.groupby(['occupation', 'gender']).agg({'gender': 'count'})
# # create a DataFra... | _____no_output_____ | MIT | Python/Pandas_Practice/3_Occupation_Exercise.ipynb | gurher/TID |
Deutsch-Jozsa Algorithm In this section, we first introduce the Deutsch-Jozsa problem, and classical and quantum algorithms to solve it. We then implement the quantum algorithm using Qiskit, and run it on a simulator and device. 1. Introduction The Deutsch-Jozsa algorithm, first introduced in Reference [1], was the ... | from qiskit_textbook.widgets import dj_widget
dj_widget(size="small", case="balanced") | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
3. Creating Quantum Oracles Let's see some different ways we can create a quantum oracle. For a constant function, it is simple:$\qquad$ 1. if f(x) = 0, then apply the $I$ gate to the qubit in register 2. $\qquad$ 2. if f(x) = 1, then apply the $X$ gate to the qubit in register 2.For a balanced function, there are m... | # initialization
import numpy as np
# importing Qiskit
from qiskit import IBMQ, Aer
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, transpile
# import basic plot tools
from qiskit.visualization import plot_histogram | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Next, we set the size of the input register for our oracle: | # set the length of the n-bit input string.
n = 3 | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
4.1 Constant Oracle Let's start by creating a constant oracle, in this case the input has no effect on the output so we just randomly set the output qubit to be 0 or 1: | # set the length of the n-bit input string.
n = 3
const_oracle = QuantumCircuit(n+1)
output = np.random.randint(2)
if output == 1:
const_oracle.x(n)
const_oracle.draw() | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
4.2 Balanced Oracle | balanced_oracle = QuantumCircuit(n+1) | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Next, we create a balanced oracle. As we saw in section 1b, we can create a balanced oracle by performing CNOTs with each input qubit as a control and the output bit as the target. We can vary the input states that give 0 or 1 by wrapping some of the controls in X-gates. Let's first choose a binary string of length `n`... | b_str = "101" | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Now we have this string, we can use it as a key to place our X-gates. For each qubit in our circuit, we place an X-gate if the corresponding digit in `b_str` is `1`, or do nothing if the digit is `0`. | balanced_oracle = QuantumCircuit(n+1)
b_str = "101"
# Place X-gates
for qubit in range(len(b_str)):
if b_str[qubit] == '1':
balanced_oracle.x(qubit)
balanced_oracle.draw() | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Next, we do our controlled-NOT gates, using each input qubit as a control, and the output qubit as a target: | balanced_oracle = QuantumCircuit(n+1)
b_str = "101"
# Place X-gates
for qubit in range(len(b_str)):
if b_str[qubit] == '1':
balanced_oracle.x(qubit)
# Use barrier as divider
balanced_oracle.barrier()
# Controlled-NOT gates
for qubit in range(n):
balanced_oracle.cx(qubit, n)
balanced_oracle.barrier()... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Finally, we repeat the code from two cells up to finish wrapping the controls in X-gates: | balanced_oracle = QuantumCircuit(n+1)
b_str = "101"
# Place X-gates
for qubit in range(len(b_str)):
if b_str[qubit] == '1':
balanced_oracle.x(qubit)
# Use barrier as divider
balanced_oracle.barrier()
# Controlled-NOT gates
for qubit in range(n):
balanced_oracle.cx(qubit, n)
balanced_oracle.barrier()... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
We have just created a balanced oracle! All that's left to do is see if the Deutsch-Jozsa algorithm can solve it. 4.3 The Full Algorithm Let's now put everything together. This first step in the algorithm is to initialize the input qubits in the state $|{+}\rangle$ and the output qubit in the state $|{-}\rangle$: | dj_circuit = QuantumCircuit(n+1, n)
# Apply H-gates
for qubit in range(n):
dj_circuit.h(qubit)
# Put qubit in state |->
dj_circuit.x(n)
dj_circuit.h(n)
dj_circuit.draw() | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Next, let's apply the oracle. Here we apply the `balanced_oracle` we created above: | dj_circuit = QuantumCircuit(n+1, n)
# Apply H-gates
for qubit in range(n):
dj_circuit.h(qubit)
# Put qubit in state |->
dj_circuit.x(n)
dj_circuit.h(n)
# Add oracle
dj_circuit = dj_circuit.compose(balanced_oracle)
dj_circuit.draw() | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Finally, we perform H-gates on the $n$-input qubits, and measure our input register: | dj_circuit = QuantumCircuit(n+1, n)
# Apply H-gates
for qubit in range(n):
dj_circuit.h(qubit)
# Put qubit in state |->
dj_circuit.x(n)
dj_circuit.h(n)
# Add oracle
dj_circuit = dj_circuit.compose(balanced_oracle)
# Repeat H-gates
for qubit in range(n):
dj_circuit.h(qubit)
dj_circuit.barrier()
# Measure
fo... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Let's see the output: | # use local simulator
aer_sim = Aer.get_backend('aer_simulator')
results = aer_sim.run(dj_circuit).result()
answer = results.get_counts()
plot_histogram(answer) | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
We can see from the results above that we have a 0% chance of measuring `000`. This correctly predicts the function is balanced. 4.4 Generalised Circuits Below, we provide a generalised function that creates Deutsch-Jozsa oracles and turns them into quantum gates. It takes the `case`, (either `'balanced'` or '`constan... | def dj_oracle(case, n):
# We need to make a QuantumCircuit object to return
# This circuit has n+1 qubits: the size of the input,
# plus one output qubit
oracle_qc = QuantumCircuit(n+1)
# First, let's deal with the case in which oracle is balanced
if case == "balanced":
# First gene... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Let's also create a function that takes this oracle gate and performs the Deutsch-Jozsa algorithm on it: | def dj_algorithm(oracle, n):
dj_circuit = QuantumCircuit(n+1, n)
# Set up the output qubit:
dj_circuit.x(n)
dj_circuit.h(n)
# And set up the input register:
for qubit in range(n):
dj_circuit.h(qubit)
# Let's append the oracle gate to our circuit:
dj_circuit.append(oracle, range(n... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
Finally, let's use these functions to play around with the algorithm: | n = 4
oracle_gate = dj_oracle('balanced', n)
dj_circuit = dj_algorithm(oracle_gate, n)
dj_circuit.draw() | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
And see the results of running this circuit: | transpiled_dj_circuit = transpile(dj_circuit, aer_sim)
results = aer_sim.run(transpiled_dj_circuit).result()
answer = results.get_counts()
plot_histogram(answer) | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
5. Experiment with Real Devices We can run the circuit on the real device as shown below. We first look for the least-busy device that can handle our circuit. | # Load our saved IBMQ accounts and get the least busy backend device with greater than or equal to (n+1) qubits
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q')
backend = least_busy(provider.backends(filters=lambda x: x.configuration().n_qubits >= (n+1) and
not x.configur... | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
As we can see, the most likely result is `1111`. The other results are due to errors in the quantum computation. 6. Problems 1. Are you able to create a balanced or constant oracle of a different form?2. The function `dj_problem_oracle` (below) returns a Deutsch-Jozsa oracle for `n = 4` in the form of a gate. The gat... | from qiskit_textbook.problems import dj_problem_oracle
oracle = dj_problem_oracle(1) | _____no_output_____ | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
7. References 1. David Deutsch and Richard Jozsa (1992). "Rapid solutions of problems by quantum computation". Proceedings of the Royal Society of London A. 439: 553β558. [doi:10.1098/rspa.1992.0167](https://doi.org/10.1098%2Frspa.1992.0167).2. R. Cleve; A. Ekert; C. Macchiavello; M. Mosca (1998). "Quantum algorithms... | import qiskit.tools.jupyter
%qiskit_version_table | /usr/local/anaconda3/envs/terra-unstable/lib/python3.9/site-packages/qiskit/aqua/__init__.py:86: DeprecationWarning: The package qiskit.aqua is deprecated. It was moved/refactored to qiskit-terra For more information see <https://github.com/Qiskit/qiskit-aqua/blob/main/README.md#migration-guide>
warn_package('aqua', ... | Apache-2.0 | notebooks/ch-algorithms/deutsch-jozsa.ipynb | kifumi/platypus |
APS 2 - Sistemas de equaΓ§Γ΅es (matrizes). Considerar epsilon_s = 0,0001%. Explicar como funcionam os comandos de inversΓ£o de matriz e multiplicaΓ§Γ£o de matrizes usados pela linguagem de programaΓ§Γ£o Python. | import numpy as np
import math
import matplotlib.pyplot as plt
np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)})
%matplotlib inline | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
ExercΓcio 12.23 | matrix = np.array([ [1,-1,-1,0],
[-35,0,-5,200],
[0,-27,5,0]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Utilizando a eliminaΓ§Γ£o de Gauss ingΓͺnua: | temp = matrix[1][0]/matrix[0][0]
for i in range(4):
matrix[1][i] -= temp*matrix[0][i]
temp = matrix[2][1]/matrix[1][1]
for i in range(4):
matrix[2][i] -= temp*matrix[1][i]
print(matrix) | [[1.000 -1.000 -1.000 0.000]
[0.000 -35.000 -40.000 200.000]
[0.000 0.000 35.857 -154.286]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i3: | i3 = -154.286/35.857
print(i3) | -4.302813955434085
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i2: | i2 = (40*i3+200)/-35
print(i2) | -0.7967840509324738
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i1: | i1 = i2+i3
print(i1) | -5.099598006366559
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
O sinal negativo da corrente indica que ela tem sinal contrΓ‘rio ao que estΓ‘ no desenho acima. ExercΓcio 12.25utilizar eliminaΓ§Γ£o de Gauss com pivotamento. Matriz obtida a partir das leis de Kirchoff aplicadas ao circuito elΓ©trico: | matrix = np.array([
[-75,-25, 0, 0,-20, 0,-70],
[0 ,-25,-5, 0, 0, 0, 0],
[0 , 0,-5,-10, 25, 0, 0],
[1 , -1, 0, 0, 0,-1, 0],
[1 , 0, 0, -1, -1, 0, 0],
[0 , 1, -1, 0, -1, 0, 0]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Matriz pivotada manualmente: | matrix = np.array([
[-75,-25, 0, 0,-20, 0,-70],
[0 ,-25,-5, 0, 0, 0, 0],
[0 , 0,-5,-10, 25, 0, 0],
[1 , 0, 0, -1, -1, 0, 0],
[0 , 1, -1, 0, -1, 0, 0],
[1 , -1, 0, 0, 0,-1, 0]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Primeiro coeficiente: | temp = matrix[3][0]/matrix[0][0]
for i in range(7):
matrix[3][i] -= temp*matrix[0][i]
temp = matrix[5][0]/matrix[0][0]
for i in range(7):
matrix[5][i] -= temp*matrix[0][i]
print(matrix) | [[-75.000 -25.000 0.000 0.000 -20.000 0.000 -70.000]
[0.000 -25.000 -5.000 0.000 0.000 0.000 0.000]
[0.000 0.000 -5.000 -10.000 25.000 0.000 0.000]
[0.000 -0.333 0.000 -1.000 -1.267 0.000 -0.933]
[0.000 1.000 -1.000 0.000 -1.000 0.000 0.000]
[0.000 -1.333 0.000 0.000 -0.267 -1.000 -0.933]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Segundo coeficiente: | temp = matrix[3][1]/matrix[1][1]
for i in range(7):
matrix[3][i] -= temp*matrix[1][i]
temp = matrix[4][1]/matrix[1][1]
for i in range(7):
matrix[4][i] -= temp*matrix[1][i]
temp = matrix[5][1]/matrix[1][1]
for i in range(7):
matrix[5][i] -= temp*matrix[1][i]
print(matrix) | [[-75.000 -25.000 0.000 0.000 -20.000 0.000 -70.000]
[0.000 -25.000 -5.000 0.000 0.000 0.000 0.000]
[0.000 0.000 -5.000 -10.000 25.000 0.000 0.000]
[0.000 0.000 0.067 -1.000 -1.267 0.000 -0.933]
[0.000 0.000 -1.200 0.000 -1.000 0.000 0.000]
[0.000 0.000 0.267 0.000 -0.267 -1.000 -0.933]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Terceiro coeficiente: | temp = matrix[3][2]/matrix[2][2]
for i in range(6):
matrix[3][i] -= temp*matrix[2][i]
temp = matrix[4][2]/matrix[2][2]
for i in range(6):
matrix[4][i] -= temp*matrix[2][i]
temp = matrix[5][2]/matrix[2][2]
for i in range(6):
matrix[5][i] -= temp*matrix[2][i]
print(matrix) | [[-75.000 -25.000 0.000 0.000 -20.000 0.000 -70.000]
[0.000 -25.000 -5.000 0.000 0.000 0.000 0.000]
[0.000 0.000 -5.000 -10.000 25.000 0.000 0.000]
[0.000 0.000 0.000 -1.133 -0.933 0.000 -0.933]
[0.000 0.000 0.000 2.400 -7.000 0.000 0.000]
[0.000 0.000 0.000 -0.533 1.067 -1.000 -0.933]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Quarto coeficiente: | temp = matrix[4][3]/matrix[3][3]
for i in range(7):
matrix[4][i] -= temp*matrix[3][i]
temp = matrix[5][3]/matrix[3][3]
for i in range(7):
matrix[5][i] -= temp*matrix[3][i]
print(matrix) | [[-75.000 -25.000 0.000 0.000 -20.000 0.000 -70.000]
[0.000 -25.000 -5.000 0.000 0.000 0.000 0.000]
[0.000 0.000 -5.000 -10.000 25.000 0.000 0.000]
[0.000 0.000 0.000 -1.133 -0.933 0.000 -0.933]
[0.000 0.000 0.000 0.000 -8.976 0.000 -1.976]
[0.000 0.000 0.000 0.000 1.506 -1.000 -0.494]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Quinto coeficiente: | temp = matrix[5][4]/matrix[4][4]
for i in range(7):
matrix[5][i] -= temp*matrix[4][i]
print(matrix) | [[-75.000 -25.000 0.000 0.000 -20.000 0.000 -70.000]
[0.000 -25.000 -5.000 0.000 0.000 0.000 0.000]
[0.000 0.000 -5.000 -10.000 25.000 0.000 0.000]
[0.000 0.000 0.000 -1.133 -0.933 0.000 -0.933]
[0.000 0.000 0.000 0.000 -8.976 0.000 -1.976]
[0.000 0.000 0.000 0.000 0.000 -1.000 -0.826]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i6: | i6 = -0.826/-1
print(i6) | 0.826
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i5: | i5 = -1.976/-8.976
print(i5) | 0.22014260249554365
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i4: | i4 = (-0.933 + 0.933*i5)/-1.133
print(i4) | 0.6421950148911366
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i3: | i3 = (-25*i5 + 10*i4)/-5
print(i3) | -0.1836770173045549
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i2: | i2 = 5*i3/-25
print(i2) | 0.03673540346091098
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i1: | i1 = (-70+20*i5+25*i2)/-75
print(i1) | 0.8623835048475513
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
ExercΓcio 12.27 Utilizando eliminaΓ§Γ£o de Gauss com pivotamento (pivotamento executado manualmente), vem: O pivotamento cumpre o propΓ³sito de evitar a divisΓ£o por zero na eliminaΓ§Γ£o de Gauss, e consiste em reordenar as linhas de forma que o elemento pivΓ΄ (geralmente o da diagonal principal), nΓ£o seja zero. Matriz ob... | matrix = np.array([
[0 ,0 ,1 ,1 ,-1, 0],
[-1,0 ,1 ,0 ,1 , 0],
[-1,1 ,1 ,0 ,0 , 0],
[-5,0 ,-15,0 ,0 ,-80],
[0 ,0 ,-20,25 ,0 , 50]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Matriz pivotada: | matrix = np.array([
[-5,0 ,-15,0 ,0 ,-80],
[-1,1 ,1 ,0 ,0 , 0],
[-1,0 ,1 ,0 ,1 , 0],
[0 ,0 ,1 ,1 ,-1, 0],
[0 ,0 ,-20,25 ,0 , 50]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Primeiro coeficiente: | temp = matrix[1][0]/matrix[0][0]
for i in range(6):
matrix[1][i] -= temp*matrix[0][i]
temp = matrix[2][0]/matrix[0][0]
for i in range(6):
matrix[2][i] -= temp*matrix[0][i]
print(matrix) | [[-5.000 0.000 -15.000 0.000 0.000 -80.000]
[0.000 1.000 4.000 0.000 0.000 16.000]
[0.000 0.000 4.000 0.000 1.000 16.000]
[0.000 0.000 1.000 1.000 -1.000 0.000]
[0.000 0.000 -20.000 25.000 0.000 50.000]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Terceiro coeficiente: | temp = matrix[3][2]/matrix[2][2]
for i in range(6):
matrix[3][i] -= temp*matrix[2][i]
temp = matrix[4][2]/matrix[2][2]
for i in range(6):
matrix[4][i] -= temp*matrix[2][i]
print(matrix) | [[-5.000 0.000 -15.000 0.000 0.000 -80.000]
[0.000 1.000 4.000 0.000 0.000 16.000]
[0.000 0.000 4.000 0.000 1.000 16.000]
[0.000 0.000 0.000 1.000 -1.250 -4.000]
[0.000 0.000 0.000 25.000 5.000 130.000]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Quarto coeficiente: | temp = matrix[4][3]/matrix[3][3]
for i in range(6):
matrix[4][i] -= temp*matrix[3][i]
print(matrix) | [[-5.000 0.000 -15.000 0.000 0.000 -80.000]
[0.000 1.000 4.000 0.000 0.000 16.000]
[0.000 0.000 4.000 0.000 1.000 16.000]
[0.000 0.000 0.000 1.000 -1.250 -4.000]
[0.000 0.000 0.000 0.000 36.250 230.000]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
SubstituiΓ§Γ£o regressiva: i5: | i5 = 230.000/36.250
print(i5) | 6.344827586206897
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i4: | i4 = -4 + 1.25*i5
print(i4) | 3.931034482758621
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i3: | i3 = (16) -i5 /4
print(i3) | 14.413793103448276
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i2: | i2 = 16 - 4*i3
print(i2) | -41.6551724137931
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i1: | i1 = (-80 + 15*i3) / 5
print(i1) | 27.241379310344826
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
ExercΓcio 12.28 Matriz obtida a partir das leis de Kirchoff aplicadas ao circuito elΓ©trico: | matrix = np.array([
[1,-1 ,-1, 0, 0, 0, 0],
[0, 1 , 0, 0, 1,-1, 0],
[0, 0 ,-4,-2, 0, 0,-20],
[0 ,-6, 4, 0, 8, 0, 0],
[0 ,0 ,-1, 1, 1, 0, 0],
[0 ,0 , 0,-2, 8, 5, 0]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Matriz pivotada manualmente: | matrix = np.array([
[1,-1 ,-1, 0, 0, 0, 0],
[0, 1 , 0, 0, 1,-1, 0],
[0, 0 ,-4,-2, 0, 0,-20],
[0 ,0 ,-1, 1, 1, 0, 0],
[0 ,-6, 4, 0, 8, 0, 0],
[0 ,0 , 0,-2, 8, 5, 0]
])
matrix = matrix.astype('float64') | _____no_output_____ | MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Segundo coeficiente: | temp = matrix[4][1]/matrix[1][1]
for i in range(7):
matrix[4][i] -= temp*matrix[1][i]
print(matrix) | [[1.000 -1.000 -1.000 0.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000 1.000 -1.000 0.000]
[0.000 0.000 -4.000 -2.000 0.000 0.000 -20.000]
[0.000 0.000 -1.000 1.000 1.000 0.000 0.000]
[0.000 0.000 4.000 0.000 14.000 -6.000 0.000]
[0.000 0.000 0.000 -2.000 8.000 5.000 0.000]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Terceiro coeficiente: | temp = matrix[3][2]/matrix[2][2]
for i in range(7):
matrix[3][i] -= temp*matrix[2][i]
temp = matrix[4][2]/matrix[2][2]
for i in range(7):
matrix[4][i] -= temp*matrix[2][i]
print(matrix) | [[1.000 -1.000 -1.000 0.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000 1.000 -1.000 0.000]
[0.000 0.000 -4.000 -2.000 0.000 0.000 -20.000]
[0.000 0.000 0.000 1.500 1.000 0.000 5.000]
[0.000 0.000 0.000 -2.000 14.000 -6.000 -20.000]
[0.000 0.000 0.000 -2.000 8.000 5.000 0.000]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Quarto coeficiente: | temp = matrix[4][3]/matrix[3][3]
for i in range(7):
matrix[4][i] -= temp*matrix[3][i]
temp = matrix[5][3]/matrix[3][3]
for i in range(7):
matrix[5][i] -= temp*matrix[3][i]
print(matrix) | [[1.000 -1.000 -1.000 0.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000 1.000 -1.000 0.000]
[0.000 0.000 -4.000 -2.000 0.000 0.000 -20.000]
[0.000 0.000 0.000 1.500 1.000 0.000 5.000]
[0.000 0.000 0.000 0.000 15.333 -6.000 -13.333]
[0.000 0.000 0.000 0.000 9.333 5.000 6.667]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Quinto coeficiente: | temp = matrix[5][4]/matrix[4][4]
for i in range(7):
matrix[5][i] -= temp*matrix[4][i]
print(matrix) | [[1.000 -1.000 -1.000 0.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000 1.000 -1.000 0.000]
[0.000 0.000 -4.000 -2.000 0.000 0.000 -20.000]
[0.000 0.000 0.000 1.500 1.000 0.000 5.000]
[0.000 0.000 0.000 0.000 15.333 -6.000 -13.333]
[0.000 0.000 0.000 0.000 0.000 8.652 14.783]]
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i6: | i6 = 14.783/8.652
print(i6) | 1.7086222838650025
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i5: | i5 = (6.000*i6 - 13.333)/15.333
print(i5) | -0.20095651841192105
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i4: | i4 = (5-i5)/1.5
print(i4) | 3.4673043456079475
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i3: | i3 = (-20 + 2*i4)/-4
print(i3) | 3.266347827196026
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i2: | i2 = i6-i5
print(i2) | 1.9095788022769236
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
i1: | i1 = i2+i3
print(i1) | 5.17592662947295
| MIT | APS2-sistemas-de-equacoes-matrizes.ipynb | alcapriles/seven |
Visualization of a 2d Gaussian density as a surface and contour plots | import jax
import jax.numpy as jnp
import jax.scipy
from jax.config import config
from jax.scipy.stats import multivariate_normal
from matplotlib import colors
from matplotlib.colors import LightSource
from mpl_toolkits.mplot3d import axes3d
import numpy as np
import seaborn as sns
import os
import matplotlib.pyplot as... | _____no_output_____ | MIT | notebooks/book1/03/gauss_plot_2d.ipynb | patel-zeel/pyprobml |
Load data | df = pd.read_csv('../../Data/Chapter_1_cleaned_data.csv')
features_response = df.columns.tolist()
items_to_remove = ['ID', 'SEX',
'PAY_2', 'PAY_3', 'PAY_4', 'PAY_5', 'PAY_6',
'EDUCATION_CAT',
'graduate school', 'high school', 'none',
'others', ... | (26664, 17) (26664,)
| MIT | Chapter03/Exercise02/Exercise02.ipynb | MaheshPackt/Data-Science-Projects-2nd |
Exercise 3.02: Visualizing the Relationship Between Features and Response | overall_default_rate = df['default payment next month'].mean()
overall_default_rate
group_by_pay_mean_y = df.groupby('PAY_1').agg(
{'default payment next month':np.mean})
group_by_pay_mean_y
axes = plt.axes()
axes.axhline(overall_default_rate, color='red')
group_by_pay_mean_y.plot(marker='x', legend=False, ax=axes)... | <ipython-input-14-58af298f658f>:15: UserWarning: FixedFormatter should only be used together with FixedLocator
axes.set_yticklabels(np.round(y_ticks*50000,2))
| MIT | Chapter03/Exercise02/Exercise02.ipynb | MaheshPackt/Data-Science-Projects-2nd |
Stock Market Prediction And Forecasting Using Stacked LSTM | ### Keras and Tensorflow >2.0
### Data Collection
import pandas_datareader as pdr
key=""
df = pdr.get_data_tiingo('AAPL', api_key='11dfb33f50f81bf08437b4bbf7619d48cad950ff')
df.to_csv('AAPL.csv')
import pandas as pd
df=pd.read_csv('AAPL.csv')
df.head()
df.tail()
df1=df.reset_index()['close']
df1
import matplotlib.pyplo... | _____no_output_____ | MIT | Predictive Modelling/Stock-Prediction/prediction.ipynb | mukherjeetejas/Machine-learning |
Exporting data from BigQuery to Google Cloud StorageIn this notebook, we export BigQuery data to GCS so that we can reuse our Keras model that was developed on CSV data. | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os
PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PROJECT NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# Do not change these
os.environ["... | _____no_output_____ | Apache-2.0 | quests/serverlessml/07_caip/solution/export_data.ipynb | jonesevan007/training-data-analyst |
Create BigQuery dataset and GCS BucketIf you haven't already, create the the BigQuery dataset and GCS Bucket we will need. | %%bash
## Create a BigQuery dataset for serverlessml if it doesn't exist
datasetexists=$(bq ls -d | grep -w serverlessml)
if [ -n "$datasetexists" ]; then
echo -e "BigQuery dataset already exists, let's not recreate it."
else
echo "Creating BigQuery dataset titled: serverlessml"
bq --location=US... | BigQuery dataset already exists, let's not recreate it.
Bucket exists, let's not recreate it.
| Apache-2.0 | quests/serverlessml/07_caip/solution/export_data.ipynb | jonesevan007/training-data-analyst |
Create BigQuery tables Let's create a table with 1 million examples.Note that the order of columns is exactly what was in our CSV files. | %%bigquery
CREATE OR REPLACE TABLE serverlessml.feateng_training_data AS
SELECT
(tolls_amount + fare_amount) AS fare_amount,
pickup_datetime,
pickup_longitude AS pickuplon,
pickup_latitude AS pickuplat,
dropoff_longitude AS dropofflon,
dropoff_latitude AS dropofflat,
passenger_count*1.0 AS passengers,
... | _____no_output_____ | Apache-2.0 | quests/serverlessml/07_caip/solution/export_data.ipynb | jonesevan007/training-data-analyst |
Make the validation dataset be 1/10 the size of the training dataset. | %%bigquery
CREATE OR REPLACE TABLE serverlessml.feateng_valid_data AS
SELECT
(tolls_amount + fare_amount) AS fare_amount,
pickup_datetime,
pickup_longitude AS pickuplon,
pickup_latitude AS pickuplat,
dropoff_longitude AS dropofflon,
dropoff_latitude AS dropofflat,
passenger_count*1.0 AS passengers,
'un... | _____no_output_____ | Apache-2.0 | quests/serverlessml/07_caip/solution/export_data.ipynb | jonesevan007/training-data-analyst |
Export the tables as CSV filesChange the BUCKET variable below to match a bucket that you own. | %%bash
OUTDIR=gs://$BUCKET/quests/serverlessml/data
echo "Deleting current contents of $OUTDIR"
gsutil -m -q rm -rf $OUTDIR
echo "Extracting training data to $OUTDIR"
bq --location=US extract \
--destination_format CSV \
--field_delimiter "," --noprint_header \
serverlessml.feateng_training_data \
$OUTDIR... | 52,2015-02-07 23:10:27 UTC,-73.781852722167969,40.644840240478516,-73.967453002929688,40.771881103515625,2,unused
57.33,2015-02-15 12:22:12 UTC,-73.98321533203125,40.738700866699219,-73.78955078125,40.642852783203125,2,unused
| Apache-2.0 | quests/serverlessml/07_caip/solution/export_data.ipynb | jonesevan007/training-data-analyst |
Lineal Systems pt. 1 First Execersice$$y^{'}= Ay$$$$A = \begin{bmatrix}-1 & 1\\-5 & -5\end{bmatrix} $$$\textit{Initial Value Problem}$ $$y(0) = \begin{bmatrix}1\\5\end{bmatrix} $$ | from DE import lineal_system
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
IVP = [1, -5]
# Time line
t = np.linspace(0, 30, 60)
# solve ODEs
x1, y1, x2, y2 = -1, 1, -5, -5
y = odeint(lineal_system,IVP,t, args=(x1, y1, x2, y2,))
# Plot x-axis
x_axis = y[:,0]
plt.semilogy(t, x_ax... | _____no_output_____ | MIT | Lineal systems 1.ipynb | DavidHdezU/DifferentialEquations |
Second Execersice$$y^{'}= Ay$$$$A = \begin{bmatrix}-5 & 1\\-2 & -2\end{bmatrix} $$$\textit{Initial Value Problem}$ $$y(0) = \begin{bmatrix}0\\-1\end{bmatrix} $$ | IVP = [0, -1]
# Time line
t = np.linspace(0, 30, 60)
# solve system
x1, y1, x2, y2 = -5, 1, -2, -2
y = odeint(lineal_system,IVP,t, args=(x1, y1, x2, y2,))
# Plot x-axis
x_axis = y[:,0]
plt.semilogy(t, x_axis)
plt.xlabel('time')
plt.ylabel('x_axis')
plt.legend()
plt.show()
# Plot y-axis
y_axis = y[:,1]
plt.semilogy(t, ... | _____no_output_____ | MIT | Lineal systems 1.ipynb | DavidHdezU/DifferentialEquations |
See multiple curve solutions |
# Slope fields
# Solution curve
# Vector field
X, Y = np.meshgrid(np.linspace(-10, 10, 20), np.linspace(-10, 10, 20))
U = x1*X + y1*Y
V = x2*X + y2*Y
# Normalize arrows
N = np.sqrt(U ** 2 + V ** 2)
U = U / N
V = V / N
plt.quiver(X, Y, U, V, angles="xy")
for y0 in np.linspace(-5.0, 0.0, 10):
y_initial = [y0, -10.... | _____no_output_____ | MIT | Lineal systems 1.ipynb | DavidHdezU/DifferentialEquations |
This notebook shows how to wrap a function with a `Process`, then to call it in a `Pipeline` Make a new `Process`To understand how a `Process` works, we will create a new one here. We will make one specific for transliteration, then subclass that for a particular language. | from cltk.core.data_types import Process
# this code in the CLTK takes the Anglo-Saxon runic alphabet and turns it into the Latin alphabet
from cltk.phonology.ang.transliteration import Transliterate
oe_runes = "α©α α αα³α£αα αα³αα αα αα³α α¦ααΎαͺ α¦α±α αα’α" # type str
oe_latin = Transliterate().transliterate(text=oe_runes, mode="L... | [('α©α α', 'oft'), ('αα³α£αα', 'scyld'), ('αα³αα αα', 'scefin'), ('αα³α α¦ααΎαͺ', 'sceathena'), ('α¦α±α αα’α', 'threatum')]
| MIT | notebooks/Make custom Process and add to Pipeline.ipynb | free-variation/cltk |
Note that most ``Process``es in the CLTK library are more complex than this, as they allow for inheritance, which helps the project scale better. For instance:`Process` <--- `StemmingProcess` <--- {`LatinStemmingProcess`, `MiddleEnglishStemmingProcess`, `MiddleHighGermanStemmingProcess`, `OldFrenchStemmingProcess`}In t... | from cltk import NLP
# Load the Old English NLP class
cltk_nlp = NLP(language="ang")
# Inspect the Pipline, which is contained in NLP
from pprint import pprint
pprint(cltk_nlp.pipeline.processes)
# Add the new custom Process to the end
cltk_nlp.pipeline.processes.append(OldEnglishTransliterationProcess)
# Now run the p... | Word(index_char_start=0, index_char_stop=3, index_token=0, index_sentence=None, string='α©α α', pos=None, lemma='α©α α', stem=None, scansion=None, xpos=None, upos=None, dependency_relation=None, governor=None, features={}, category={}, embedding=array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
... | MIT | notebooks/Make custom Process and add to Pipeline.ipynb | free-variation/cltk |
Computer Vision Learner [`vision.learner`](/text.learner.htmltext.learner) is the module that defines the `Conv_Learner` class, to easily get a model suitable for transfer learning. | from fastai.gen_doc.nbdoc import *
from fastai.vision import *
from fastai import *
from fastai.docs import * | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
Transfer learning Transfer learning is a technique where you use a model trained on a very large dataset (usually [ImageNet](http://image-net.org/) in computer vision) and then adapt it to your own dataset. The idea is that it has learned to recognize many features on all of this data, and that you will benefit from t... | show_doc(ConvLearner, doc_string=False) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
This class creates a [[[`Learner`](/basic_train.htmlLearner)](/basic_train.htmlLearner)](/basic_train.htmlLearner) object from the [`data`](/text.data.htmltext.data) object and model inferred from it with the backbone given in `arch`. Specifically, it will cut the model defined by `arch` (randomly initialized if `pretr... | untar_mnist()
data = image_data_from_folder(MNIST_PATH, ds_tfms=get_transforms(do_flip=False, max_warp=0), size=32)
learner = ConvLearner(data, tvm.resnet18, metrics=[accuracy])
learner.fit_one_cycle(1,1e-3) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
Customize your model You can customize [`ConvLearner`](/vision.learner.htmlConvLearner) for your own models default `cut` and `split_on` functions by adding it them the dictionary `model_meta`. The key should be your model and the value should be a dictionary with the keys `cut` and `split_on` (see the source code for... | show_doc(create_body)
show_doc(create_head, doc_string=False) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
Model head that takes `nf` features, runs through `lin_ftrs`, and ends with `nc` classes. `ps` is the probability of the dropouts, as documented above in [`ConvLearner`](/vision.learner.htmlConvLearner). Utility methods | show_doc(num_features)
show_doc(ClassificationInterpretation) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
This provides a confusion matrix and visualization of the most incorrect images. Pass in your [`data`](/text.data.htmltext.data), calculated `preds`, actual `y`, and the class of your loss function, and then use the methods below to view the model interpretation results. For instance: | learn = ConvLearner(get_mnist(), tvm.resnet18)
learn.fit(1)
preds,y = learn.get_preds()
interp = ClassificationInterpretation(data, preds, y, loss_class=nn.CrossEntropyLoss)
show_doc(ClassificationInterpretation.plot_top_losses) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
The `k` items are arranged as a square, so it will look best if `k` is a square number (4, 9, 16, etc). The title of each image shows: prediction, actual, loss, probability of actual class. | interp.plot_top_losses(9, figsize=(7,7))
show_doc(ClassificationInterpretation.top_losses) | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
Returns tuple of *(losses,indices)*. | interp.top_losses(9)
show_doc(ClassificationInterpretation.plot_confusion_matrix)
interp.plot_confusion_matrix()
show_doc(ClassificationInterpretation.confusion_matrix)
interp.confusion_matrix() | _____no_output_____ | Apache-2.0 | docs_src/vision.learner.ipynb | Gokkulnath/fastai_v1 |
IntroductionState notebook purpose here ImportsImport libraries and write settings here. | # Data manipulation
import pandas as pd
import numpy as np
# Options for pandas
pd.options.display.max_columns = 50
pd.options.display.max_rows = 30
# Display all cell outputs
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = 'all'
from IPython import get_ipython
ip... | _____no_output_____ | MIT | copernican/exploratory work.ipynb | ventureBorbot/Data-Analysis |
`sympy` [`sympy`](https://www.sympy.org)λ *κΈ°νΈ μ²λ¦¬κΈ°*λ‘ μ«μ λμ κΈ°νΈ μ°μ°μ μ§μνλ€..[`sympy`](https://www.sympy.org), a *symbolic processor* supports operations in symbols instead of numbers. 2006λ
μ΄ν 2019 κΉμ§ 800λͺ
μ΄ λλ κ°λ°μκ° μμ±ν μ½λλ₯Ό μ 곡νμλ€.Since 2006, more than 800 developers contributed so far in 2019. κΈ°νΈ μ°μ° μExamples of symbolic p... | import sympy as sym
sym.init_printing()
| _____no_output_____ | BSD-3-Clause | 45_sympy/10_sympy.ipynb | kangwon-naver/nmisp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.