Unnamed: 0 int64 0 16k | text_prompt stringlengths 110 62.1k | code_prompt stringlengths 37 152k |
|---|---|---|
6,700 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Classification with Support Vector Machines
by Soeren Sonnenburg | Saurabh Mahindre - <a href=\"https
Step1: Liblinear, a library for large- scale linear learning focusing on SVM, is used t... | Python Code:
import matplotlib.pyplot as plt
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import matplotlib.patches as patches
#To import all shogun classes
import shogun as sg
import numpy as np
#Generate some random data
X = 2 * np.random.randn(10,2)
traindata=np.r_[X + 3... |
6,701 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Interactuando con Twitter
Introducción
En este cuaderno vamos a crear un bot de twitter (un programa que interactúa de manera semi-automática con twitter) que muestre ciertas capacidades lin... | Python Code:
import tweepy
# añade las credenciales de tu aplicación de twitter como cadenas de texto
CONSUMER_KEY = 'CAMBIA ESTO'
CONSUMER_SECRET = 'CAMBIA ESTO'
ACCESS_TOKEN = 'CAMBIA ESTO'
ACCESS_TOKEN_SECRET = 'CAMBIA ESTO'
# autentica las credenciales
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth... |
6,702 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Pyparsing Tutorial to capture ML-SQL language
Authors
Written by
Step1: Phone number parser
Mentioned in the tutorial
Grammer
Step2: Chemical Formula parser
Mentioned in the tutorial
Gramm... | Python Code:
from pyparsing import Word, Literal, alphas, Optional, OneOrMore, Group
Explanation: Pyparsing Tutorial to capture ML-SQL language
Authors
Written by: Neeraj Asthana (under Professor Robert Brunner)
University of Illinois at Urbana-Champaign
Summer 2016
Acknowledgements
Followed Tutorial at: http://www.onl... |
6,703 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Flux Noise Mask Design
General Notes
Step1: CPW
We want to use the same cpw dimensions for resonator and feedline/purcell filter cpw's so the kinetic inductance correction is the same for e... | Python Code:
qubits = []
for i in range(3):
q = qubit.Qubit('Transmon')
#q.C_g = 3.87e-15
#q.C_q = 75.1e-15
q.C_g = 1.8e-15
q.C_q = 77.1e-15
q.C_resToGnd = 79.1e-15
qubits.append(q)
q = qubit.Qubit('OCSQubit')
#q.C_g = 2.94e-15
#q.C_q = 45e-15
#q.C_g = 2.75e-15
#q.C_q = 45.83e-15
q.C_g = 1.5... |
6,704 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
How to calculate kurtosis (according to Fisher’s definition) without bias correction? | Problem:
import numpy as np
import scipy.stats
a = np.array([ 1. , 2. , 2.5, 400. , 6. , 0. ])
kurtosis_result = scipy.stats.kurtosis(a) |
6,705 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Pandas Intro
From this tutorial
What is pandas? Why use Pandas?
Pandas is an open source Python Library. Like must coding languages you can manipulate data in a very easy manner. This means ... | Python Code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.set_option('max_columns', 50)
%matplotlib inline
series = pd.Series([1, "number", 6, "Happy Series!"])
series
Explanation: Pandas Intro
From this tutorial
What is pandas? Why use Pandas?
Pandas is an open source Python Library. Like ... |
6,706 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Modularisierungscheck
Fragestellung
Frage
"Wie gut passt der fachliche Schnitt zur Entwicklungsaktivität?"
Idee
Heuristik
Step1: Nur reinen Java-Quellcode betrachten
Step2: Analysis
Marker... | Python Code:
from ozapfdis import git
git_log = git.log_numstat("../../../dropover/")[['sha', 'file']]
git_log.head()
Explanation: Modularisierungscheck
Fragestellung
Frage
"Wie gut passt der fachliche Schnitt zur Entwicklungsaktivität?"
Idee
Heuristik: "Werden Änderungen innerhalb einer Komponente zusammengehörig vorg... |
6,707 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
PointGraph
This notebook presents the basic concepts behind Menpo's PointGraph class and subclasses.
PointGraph is basically Graphs with geometry (PointCloud). This means that apart from th... | Python Code:
%matplotlib inline
import numpy as np
from scipy.sparse import csr_matrix
import matplotlib.pyplot as plt
from menpo.shape import PointUndirectedGraph, PointDirectedGraph, PointTree
Explanation: PointGraph
This notebook presents the basic concepts behind Menpo's PointGraph class and subclasses.
PointGraph... |
6,708 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Network Graph Demo
Step1: Standard Usage
Step2: Look at Base Class
The NetworkView object extends NetworkViewBase. You can also generate a NetworkViewBase object by itself, which does not ... | Python Code:
from psst.network.graph import (
NetworkModel, NetworkViewBase, NetworkView
)
from psst.case import read_matpower
case = read_matpower('../cases/case118.m')
Explanation: Network Graph Demo
End of explanation
# Create the model from the case
m = NetworkModel(case, sel_bus='Bus1')
# Create the view from ... |
6,709 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural network that performs sentiment analysis. Using an RNN rather than a feedfoward network is more accurate ... | Python Code:
import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:200]
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent n... |
6,710 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Motor imagery decoding from EEG data using the Common Spatial Pattern (CSP)
Decoding of motor imagery applied to EEG data decomposed using CSP. A
classifier is then applied to features extra... | Python Code:
# Authors: Martin Billinger <martin.billinger@tugraz.at>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import Pipeline
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.model_selection import ShuffleSplit, cross_val_scor... |
6,711 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Linguistics 110
Step1: Exploring TIMIT Data <a id='timit'></a>
We will start off by exploring TIMIT data taken from 8 different regions. These measurements are taken at the midpoint of vowe... | Python Code:
# DON'T FORGET TO RUN THIS CELL
import math
import numpy as np
import pandas as pd
import seaborn as sns
import datascience as ds
import matplotlib.pyplot as plt
sns.set_style('darkgrid')
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
Explanation: Linguistics 110: Vowel Formants
Profe... |
6,712 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Planar data classification with one hidden layer
Welcome to your week 3 programming assignment. It's time to build your first neural network, which will have a hidden layer. You will see a b... | Python Code:
# Package imports
import numpy as np
import matplotlib.pyplot as plt
from testCases_v2 import *
import sklearn
import sklearn.datasets
import sklearn.linear_model
from planar_utils import plot_decision_boundary, sigmoid, load_planar_dataset, load_extra_datasets
%matplotlib inline
np.random.seed(1) # set a ... |
6,713 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sveučilište u Zagrebu<br>
Fakultet elektrotehnike i računarstva
Strojno učenje
<a href="http
Step1: Sadržaj
Matrica zabune
Osnovne mjere
F-mjera
Višeklasna klasifikacija
Procjena pogreške
S... | Python Code:
# Učitaj osnovne biblioteke...
import scipy as sp
import sklearn
import pandas as pd
%pylab inline
Explanation: Sveučilište u Zagrebu<br>
Fakultet elektrotehnike i računarstva
Strojno učenje
<a href="http://www.fer.unizg.hr/predmet/su">http://www.fer.unizg.hr/predmet/su</a>
Ak. god. 2015./2016.
Bilježnica ... |
6,714 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Matplotlib
This notebook is (will be) as small crash course on the functionality of the Matplotlib Python module for creating graphs (and embedding it in notebooks). It is of course no subst... | Python Code:
import matplotlib.pyplot as plt
Explanation: Matplotlib
This notebook is (will be) as small crash course on the functionality of the Matplotlib Python module for creating graphs (and embedding it in notebooks). It is of course no substirute for the proper Matplotlib thorough documentation.
First we need to... |
6,715 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
DATASCI W261
Step1: Part 1
Step2: (1b) Sparse vectors
Data points can typically be represented with a small number of non-zero OHE features relative to the total number of features that o... | Python Code:
labVersion = 'MIDS_MLS_week12_v_0_9'
%cd ~/Documents/W261/hw12/
import os
import sys
spark_home = os.environ['SPARK_HOME'] = \
'/Users/davidadams/packages/spark-1.5.1-bin-hadoop2.6/'
if not spark_home:
raise ValueError('SPARK_HOME enviroment variable is not set')
sys.path.insert(0,os.path.join(spark... |
6,716 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Session 7 - Parallel Processing and the Veneer command line
This session looks at options for parallel processing with Veneer - that is, by running multiple copies of Source, each with a Ven... | Python Code:
from veneer.manage import create_command_line
help(create_command_line)
veneer_install = 'D:\\src\\projects\\Veneer\\Compiled\\Source 4.1.1.4484 (public version)'
source_version = '4.1.1'
cmd_directory = 'E:\\temp\\veneer_cmd'
veneer_cmd = create_command_line(veneer_install,source_version,dest=cmd_director... |
6,717 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sympy - Symbolic algebra in Python
J.R. Johansson (jrjohansson at gmail.com)
The latest version of this IPython notebook lecture is available at http
Step1: Introduction
There are two notab... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
Explanation: Sympy - Symbolic algebra in Python
J.R. Johansson (jrjohansson at gmail.com)
The latest version of this IPython notebook lecture is available at http://github.com/jrjohansson/scientific-python-lectures.
The other notebooks in this lecture seri... |
6,718 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
lexsub
Step1: Run the default solution on dev
Step2: Evaluate the default output | Python Code:
from default import *
import os
Explanation: lexsub: default program
End of explanation
lexsub = LexSub(os.path.join('data','glove.6B.100d.magnitude'))
output = []
with open(os.path.join('data','input','dev.txt')) as f:
for line in f:
fields = line.strip().split('\t')
output.append(" ".... |
6,719 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
First, here's the SPA power function
Step1: Here are two helper functions for computing the dot product over space, and for plotting the results | Python Code:
def power(s, e):
x = np.fft.ifft(np.fft.fft(s.v) ** e).real
return spa.SemanticPointer(data=x)
Explanation: First, here's the SPA power function:
End of explanation
def spatial_dot(v, Xs, Ys, scales, xs, ys, transform=1):
identity = spa.SemanticPointer(data=np.eye(D)[0])
vs = np.zeros((len(... |
6,720 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Torneo de los 30
Partiendo de un archivo .csv con los resultados de los partidos del torneo, por fecha, hacemos un par de transformaciones y cálculos para obtener algunos gráficos y estadíst... | Python Code:
# imports iniciales
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# queremos que los gráficos se rendericen inline
%matplotlib inline
%pylab inline
# configuración para los gráficos, estilo y dimensiones
matplotlib.style.use('ggplot')
figsize(12, 12)
Explanation: ... |
6,721 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Cleaning the groundtruth images from their spurious pixels
Step2: Download the dataset from its repository at github
https
Step3: Let's compare the groundtruth image befor and afte... | Python Code:
import os
import h5py
from matplotlib import pyplot as plt
import numpy as np
from numpy import newaxis
from skimage import morphology as mo
from scipy.ndimage import distance_transform_bf as distance
def distanceTransform(bIm):
#from pythonvision.org
dist = distance(bIm)
dist = dist.max() - di... |
6,722 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
국민대, 파이썬, 데이터
W03 Python 101
Step1: NOTE
Step2: 위의 예제를 봐서 알겠지만 Python은 변수의 타입을 미리 선언하지 않습니다. 미리 선언하는 언어가 있지요. 하지만 Python은 변수의 타입 선언에 매우 자유롭습니다. 또한 PEP8에 의해 age=20이라고 하지 않고 age = 20이라고 표현한 ... | Python Code:
from IPython.display import Image
Explanation: 국민대, 파이썬, 데이터
W03 Python 101
End of explanation
age = 20
print(type(age))
print(age)
Explanation: NOTE:
이 문서에 사용되는 표(숫자 연산, 비교 연산, 문자열 포맷 변환 문자, 확장 연산, formatter에서 지원하는 타입 코드)는 인사이트 출판사에서 나온 파이썬 완벽 가이드에서 발췌했음을 알려드립니다.
Table of Contents
변수 (Variable)
연산자 (Opera... |
6,723 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Séquences 1 - Découverte de la programmation objet et du language Python
Activité 1 - Manipuler les objets Python
Compétences visées par cette activité
Step1: On dira que vous avez assigné... | Python Code:
objet1 = 'bol'
Explanation: Séquences 1 - Découverte de la programmation objet et du language Python
Activité 1 - Manipuler les objets Python
Compétences visées par cette activité :
Savoir créer des variables de types chaîne de caractères et liste. Utiliser une méthode liée à un objet par la syntaxe objet.... |
6,724 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
calculate LCIA
try first sth from ecoinvent
Step1: try now for bouillon | Python Code:
act = Database("ecoinvent 3.2 cutoff").search("pineapple")
act
act = Database("ecoinvent 3.2 cutoff").search("pineapple")[1]
act
lca = LCA(
{act.key: 1},
method=('IPCC 2013', 'climate change', 'GWP 100a'),
)
lca.lci()
lca.lcia()
lca.score
Explanation: calculate LCIA
try first sth from ecoinvent
En... |
6,725 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<span style="float
Step1: Contents
Single point
Sampling
Post-processing
Create spectrum
Single point
Let's start with calculating the vertical excitation energy and oscillator strengths at... | Python Code:
%matplotlib inline
import numpy as np
from matplotlib.pylab import *
try: import seaborn #optional, makes plots look nicer
except ImportError: pass
import moldesign as mdt
from moldesign import units as u
Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blan... |
6,726 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Using custom containers with Vertex AI Training
Learning Objectives
Step1: Configure environment settings
Set location paths, connections strings, and other environment settings. Make sure ... | Python Code:
import os
import time
import pandas as pd
from google.cloud import aiplatform, bigquery
from sklearn.compose import ColumnTransformer
from sklearn.linear_model import SGDClassifier
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder, StandardScaler
Explanation: Using custo... |
6,727 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
SciPy
Uses numpy as its core
Numerical methods for
Step1: <a id=physical_constants></a>
Physical constants
Step2: <a id=fitting></a>
Fitting
<a id=curve_fit></a>
General least-squares fitt... | Python Code:
import scipy as sp
import numpy as np
# we will need to plot stuff later
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10, 8)
plt.rcParams['font.size'] = 16
plt.rcParams['lines.linewidth'] = 2
Explanation: SciPy
Uses numpy as its core
Numerical methods for:
integratio... |
6,728 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Creating a Filter, Edge Detection
Import resources and display image
Step1: Convert the image to grayscale
Step2: TODO
Step3: Test out other filters!
You're encouraged to create other kin... | Python Code:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
import numpy as np
%matplotlib inline
# Read in the image
image = mpimg.imread(fname='images/curved_lane.jpg')
plt.imshow(X=image)
Explanation: Creating a Filter, Edge Detection
Import resources and display image
End of explanation... |
6,729 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
UCDSML Lecture 12 Part 5
Neural Networks (MLP)
Prof. James Sharpnack
Step1: Importing and installing tensorflow
install tensorflow 2.0 with conda (you do not need to install tensorflow-gpu ... | Python Code:
# This was modified from Tensorflow tutorial: https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough
# All appropriate copywrites are retained, use of this material is guided by fair use for teaching
# Some modifications made for course STA 208 by James Sharpnack jsharpna@gmail.com
... |
6,730 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Deadline
Wednesday, November 22, 2017, 11
Step1: Question 1
Measure taken
Step2: From this naive analysis, we can see that participating in the job training (JTP) program does not imply a ... | Python Code:
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split, StratifiedKFold, GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics imp... |
6,731 |
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
load doc into memory
| Python Code::
def load_doc(filename):
# open the file as read only
file = open(filename, 'r')
# read all text
text = file.read()
# close the file
file.close()
return text
|
6,732 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data analysis tools
For Week 1 assignment I'm checking correlation between race and amphetamines using the NESARC data
N0 hypothesis - there is no difference in alcohol usage between races.
... | Python Code:
import numpy
import pandas
import statsmodels.formula.api as smf
import statsmodels.stats.multicomp as multi
data = pandas.read_csv('nesarc_pds.csv', low_memory=False)
# S2AQ8A - HOW OFTEN DRANK ANY ALCOHOL IN LAST 12 MONTHS (99 - Unknown)
# S2AQ8B - NUMBER OF DRINKS OF ANY ALCOHOL USUALLY CONSUMED ON DAY... |
6,733 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Intro to Python Homework
Write a line of code that stores the value of the $atan(5)$ in the variable y.
Step1: In words, what the math.ceil and math.floor functions do?
They return round do... | Python Code:
import numpy as np
y = np.arctan(5)
Explanation: Intro to Python Homework
Write a line of code that stores the value of the $atan(5)$ in the variable y.
End of explanation
x = 2
y = 5*(x**4) - 3*x**2 + 0.5*x - 20
Explanation: In words, what the math.ceil and math.floor functions do?
They return round down ... |
6,734 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
data from first 5 columns
Step1: instantiate KNN classifier
Step2: see default settings
Step3: Get labels for prediction
Step4: using different value of K
Step5: applying logistic regre... | Python Code:
iris['data'][:5]
print(iris['DESCR'] + "\n")
iris['data'].shape
iris['target'].shape
X= iris['data']
y= iris['target']
Explanation: data from first 5 columns
End of explanation
from sklearn.neighbors import KNeighborsClassifier
knn= KNeighborsClassifier(n_neighbors=1)
Explanation: instantiate KNN classifie... |
6,735 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Assignment 2
Step3: Warmups
We'll start by implementing some simpler search and optimization methods before the real exercises.
Warmup 1
Step7: Warm-up 2
Step9: Warmup 3
Step13: W... | Python Code:
from __future__ import division
import random
import matplotlib.pyplot as plt
import pickle
import sys
sys.path.append('lib')
import networkx
Romania map data from Russell and Norvig, Chapter 3.
romania = pickle.load(open('romania_graph.pickle', 'rb'))
Explanation: Assignment 2: Graph Search
In this assign... |
6,736 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: YAML component connections
We can define the netlist connections of a component by a netlist in YAML format
Note that you define the connections as instance_source.port ->
instance... | Python Code:
import pp
gap = 0.2
wg_width = 0.5
length = 10
yaml = f
instances:
sl:
component: coupler_symmetric
settings:
gap: {gap}
wg_width: {wg_width}
sr:
component: coupler_symmetric
settings:
gap: {gap}
wg_width: {wg_width}
cs:
component: c... |
6,737 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Economics Simulation
This is a simulation of an economic marketplace in which there is a population of actors, each of which has a level of wealth. On each time step two actors (chosen by a... | Python Code:
import random
N = 5000 # Default size of the population
MU = 100. # Default mean of the population
population = [random.gauss(mu=MU, sigma=MU/5) for actor in range(N)]
Explanation: Economics Simulation
This is a simulation of an economic marketplace in which there is a population of actors, each of which ... |
6,738 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
.. _tut_modifying_data_inplace
Step1: It is often necessary to modify data once you have loaded it into memory.
Common examples of this are signal processing, feature extraction, and data
c... | Python Code:
from __future__ import print_function
import mne
import os.path as op
import numpy as np
from matplotlib import pyplot as plt
Explanation: .. _tut_modifying_data_inplace:
Modifying data in-place
End of explanation
# Load an example dataset, the preload flag loads the data into memory now
data_path = op.joi... |
6,739 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
An RNN model for temperature data
This time we will be working with real data
Step1: Please ignore any compatibility warnings and errors.
Make sure to <b>restart</b> your kernel to ensure t... | Python Code:
!pip install tensorflow==1.15.3
Explanation: An RNN model for temperature data
This time we will be working with real data: daily (Tmin, Tmax) temperature series from 36 weather stations spanning 50 years. It is to be noted that a pretty good predictor model already exists for temperatures: the average of ... |
6,740 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Illustrate usage of DAPPER to benchmark multiple DA methods.
Imports
<b>NB
Step1: DA method configurations
Step2: With Lorenz-96 instead
Step3: Other models (suitable xp's listed in HMM f... | Python Code:
%matplotlib notebook
import dapper as dpr
import dapper.da_methods as da
Explanation: Illustrate usage of DAPPER to benchmark multiple DA methods.
Imports
<b>NB:</b> If you're on <mark><b>Gooble Colab</b></mark>,
then replace %matplotlib notebook below by
!python -m pip install git+https://github.com/nanse... |
6,741 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Exercise 7 | Principle Component Analysis and K-Means Clustering
Step1: Part 1
Step2: The closest centroids to the first 3 examples should be [0, 2, 1] respectively.
Step3: Part 2
Step4: ... | Python Code:
import random
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from PIL import Image
%matplotlib inline
ex7data1 = scipy.io.loadmat('ex7data2.mat')
X = ex7data1['X']
Explanation: Exercise 7 | Principle Component Analysis and K-Means Clustering
End of explanation
def find_closest_centroids... |
6,742 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Análisis de los datos obtenidos
Uso de ipython para el análsis y muestra de los datos obtenidos durante la producción. La regulación del diámetro se hace mediante el control del filawinder. ... | Python Code:
#Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
#Abrimos el fichero csv co... |
6,743 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data Exploration & Feature Engineering
1. Data Exploration
Step1: Loading data
Step2: 2. Data Cleaning
Imputation
Step3: 2. Feature Engineering
Step4: Step2
Step5: Step 3
Step6: Step 4... | Python Code:
import pandas as pd
import numpy as np
Explanation: Data Exploration & Feature Engineering
1. Data Exploration
End of explanation
#Read files:
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
#Combine test and train into one file
train['source']='train'
test['source']='test'
data = pd.concat... |
6,744 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
An Astronomical Application of Machine Learning
Step1: Problem 1) Examine the Training Data
For this problem the training set, i.e. sources with known labels, includes stars and galaxies th... | Python Code:
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: An Astronomical Application of Machine Learning:
Separating Stars and Galaxies from SDSS
Version 0.3
By AA Miller 2017 Jan 22
AA Miller 2022 Mar 06 (v0.03)
The problems in the follow... |
6,745 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2019 The TensorFlow Authors.
Step1: Post-training float16 quantization
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https
Step2: Train an... | Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# dist... |
6,746 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
METHOD 1
Step1: METHOD 2
Step2: METHOD 3
Step3: METHOD 4 | Python Code:
chunksize = 1000
step = 0
#Get variant list. Should always be the first step after running ANNOVAR
open_file = myvariant_parsing_utils.VariantParsing()
list_file = open_file.get_variants_from_vcf(vcf_file)
#Name Collection & DB
collection_name = 'ANNOVAR_MyVariant_chunks'
db_name = 'My_Variant_Database'
#R... |
6,747 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about emb... | Python Code:
import time
import numpy as np
import tensorflow as tf
import utils
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural lang... |
6,748 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Land
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify do... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-2', 'land')
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CCCMA
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Ene... |
6,749 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data Analysis - Programming
Week 1
Oefeningen met uitwerkingen
Opageve 1. Schrijf een Python programma dat de waarheidstabel van de volgende expressie produceert
Step1: Opageve 2. De expres... | Python Code:
## Opgave 1 - uitwerking
for A in [False, True]:
for B in [False, True]:
print(A, B, not(A or B))
Explanation: Data Analysis - Programming
Week 1
Oefeningen met uitwerkingen
Opageve 1. Schrijf een Python programma dat de waarheidstabel van de volgende expressie produceert:
$\neg{(A \lor B)}$ (Q... |
6,750 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="https
Step1: Resit Assignment part A
Deadline
Step2: Please make sure you can load the English spaCy model
Step3: Exercise 1
Step4: Please test your function using the following... | Python Code:
%%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d .... |
6,751 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
UMSI course recommender database
Author
Step1: This part calculates the cosine similarity
Step2: Create a new text file called allpairs.txt
Step3: 2) Create database to store course pairs... | Python Code:
import re
import math
from operator import itemgetter
enrolled = {}
numstudents = {}
numincommon = {}
scores = {}
titles = {}
for line in open("courseenrollment.txt", "r"):
line = line.rstrip('\s\r\n')
(student, graddate, spec, term, dept, courseno) = line.split('\t')
# Create a variable c... |
6,752 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1 align="center">TensorFlow Neural Network Lab</h1>
<img src="image/notmnist.png">
In this lab, you'll use all the tools you learned from Introduction to TensorFlow to label images of Engl... | Python Code:
import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
p... |
6,753 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Simple RNN Encode-Decoder for Translation
Learning Objectives
1. Learn how to create a tf.data.Dataset for seq2seq problems
1. Learn how to train an encoder-decoder model in Keras
1. Learn h... | Python Code:
pip install nltk
import os
import pickle
import sys
import nltk
import numpy as np
import pandas as pd
import tensorflow as tf
import utils_preproc
from sklearn.model_selection import train_test_split
from tensorflow.keras.layers import GRU, Dense, Embedding, Input
from tensorflow.keras.models import Model... |
6,754 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<img src="http
Step1: There are the following multiple risk factor valuation classes available
Step2: We assum a positive correlation between the two risk factors.
Step3: Valuation Enviro... | Python Code:
from dx import *
import seaborn as sns; sns.set()
import time
t0 = time.time()
Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4">
Multi-Risk Derivatives Valuation
A specialty of DX Analytics is the valuation of derivatives instruments defi... |
6,755 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Create a Histogram
Create a histogram, fill it with random numbers, set its colour to blue, draw it.
Can you
Step1: We now create our histogram
Step2: We now import the gauss generation fr... | Python Code:
import ROOT
Explanation: Create a Histogram
Create a histogram, fill it with random numbers, set its colour to blue, draw it.
Can you:
- Can you use the native Python random number generator for this?
- Can you make your plot interactive using JSROOT?
- Can you document what you did in markdown?
End of exp... |
6,756 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Selecting Sites By Location
The National Water Information System (NWIS) makes data available for approximately 1.9 Million different locations in the US and Territories. Finding the data yo... | Python Code:
# First things first
import hydrofunctions as hf
Explanation: Selecting Sites By Location
The National Water Information System (NWIS) makes data available for approximately 1.9 Million different locations in the US and Territories. Finding the data you need within this collection can be a challenge!
There... |
6,757 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Least squares regression
Notebook version
Step1: This notebook covers the problem of fitting parametric regression models with a minimum least-squares criterion. The material presented here... | Python Code:
# Import some libraries that will be necessary for working with data and displaying plots
# To visualize plots in the notebook
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.io # To read matlab files
import pylab
# For the student tests (only for... |
6,758 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Toplevel
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specif... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-2', 'toplevel')
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NCAR
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: ... |
6,759 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Python OOP 1
Step1: Portable Greymap ( .pgm) Format
You have been provided with some image files i.e. img1, .. img4 in the data directory in portable greymap (.pgm) format. Although admitte... | Python Code:
import os
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import sys
%matplotlib inline
Explanation: Python OOP 1: Basics and Initialisation
This exercise is designed to motivate the use of object oriented programming in scientific computation via a simplified case using image... |
6,760 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
A Practical Guide to the Machine Learning Workflow
Step1: Problem 1) Obtain and Examine Training Data
As a reminder, for supervised-learning problems we use a training set, sources with kno... | Python Code:
import numpy as np
from astropy.table import Table
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: A Practical Guide to the Machine Learning Workflow:
Separating Stars and Galaxies from SDSS
Version 0.1
By AA Miller 2017 Jan 22
We will now follow the steps from the machine learning workflow... |
6,761 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1> Preprocessing using Dataflow </h1>
This notebook illustrates
Step1: Kindly ignore the deprecation warnings and incompatibility errors related to google-cloud-storage.
Step2: NOTE
Step... | Python Code:
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install --user google-cloud-bigquery==1.25.0
Explanation: <h1> Preprocessing using Dataflow </h1>
This notebook illustrates:
<ol>
<li> Creating datasets for Machine Learning using Dataflow
</ol>
<p>
While Pandas is fine for experimenti... |
6,762 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Seaice
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify ... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mpi-m', 'icon-esm-lr', 'seaice')
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: MPI-M
Source ID: ICON-ESM-LR
Topic: Seaice
Sub-Topics: Dynamics, Thermod... |
6,763 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
VQ-VAE training example
Demonstration of how to train the model specified in https
Step1: Download Cifar10 data
This requires a connection to the internet and will download ~160MB.
Step3: ... | Python Code:
!pip install dm-sonnet dm-tree
import matplotlib.pyplot as plt
import numpy as np
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
import tree
try:
import sonnet.v2 as snt
tf.enable_v2_behavior()
except ImportError:
import sonnet as snt
print("TensorFlow version {}".format(tf.__ve... |
6,764 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Titanic Validation
We import the original train.csv and test.csv files and use PassengerID as the index column.
The clean_data function then performs the following
Step1: Random Forest Mode... | Python Code:
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LogisticRegression
import pandas as pd
train = pd.read_csv('cl_train.csv', index_... |
6,765 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Day 8 - pre-class assignment SOLUTIONS
Goals for today's pre-class assignment
Use complex if statements and loops to make decisions in a computer program
Assignment instructions
Watch the vi... | Python Code:
# Imports the functionality that we need to display YouTube videos in a Jupyter Notebook.
# You need to run this cell before you run ANY of the YouTube videos.
from IPython.display import YouTubeVideo
# WATCH THE VIDEO IN FULL-SCREEN MODE
YouTubeVideo("8_wSb927nH0",width=640,height=360) # Complex 'if' ... |
6,766 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
A Naive Implementation of the Union-Find Algorithm
Given a set $M$ and a binary relation $R \subseteq M \times M$, the function $\texttt{union_find}$ returns a partition $\mathcal{P}$ of $M$... | Python Code:
def union_find(M, R):
print(f'R = {R}')
P = [ {x} for x in M ] # the trivial partition of M
print(f'P = {P}')
for x, y in R:
A = find(x, P) # find A
B = find(y, P) # find B
if A != B:
print(f'{x} ≅ {y}: combining {set(A)} and {set(B)}')
P.rem... |
6,767 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Table of Contents
<p><div class="lev1 toc-item"><a href="#1.-Weigh-in-Motion-Storage-Raw-Data" data-toc-modified-id="1.-Weigh-in-Motion-Storage-Raw-Data-1"><span class="toc-item-num">1 ... | Python Code:
from IPython.display import display
from datetime import datetime
from matplotlib import pyplot as plt
from scipy import misc
import h5py
import json
import numpy as np
import os
import pandas as pd
import sys
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#1.-Weigh-in-Motion-Storage... |
6,768 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This notebook covers the use of 'holidays' in the Prophet forecasting library. In this notebook, we will extend the previous example (http
Step1: Read in the data
Read the data in from the ... | Python Code:
import pandas as pd
import numpy as np
from fbprophet import Prophet
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize']=(20,10)
plt.style.use('ggplot')
Explanation: This notebook covers the use of 'holidays' in the Prophet forecasting library. In this notebook, we will ex... |
6,769 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Consistent models in DisMod-MR from Vivarium artifact draw
Take i, r, f, p from a Vivarium artifact, and make a consistent version of them. See how it compares to the original.
Step1: Cons... | Python Code:
np.random.seed(123456)
# if dismod_mr is not installed, it should possible to use
# !conda install --yes pymc
# !pip install dismod_mr
import dismod_mr
# you also need one more pip installable package
# !pip install vivarium_public_health
import vivarium_public_health
Explanation: Consistent models in DisM... |
6,770 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
Does scikit-learn provide facility to use SVM for regression, using a polynomial kernel (degree=2)? I looked at the APIs and I don't see any. Has anyone built a package on top of sc... | Problem:
import numpy as np
import pandas as pd
import sklearn
X, y = load_data()
assert type(X) == np.ndarray
assert type(y) == np.ndarray
# fit, then predict X
from sklearn.svm import SVR
svr_poly = SVR(kernel='poly', degree=2)
svr_poly.fit(X, y)
predict = svr_poly.predict(X) |
6,771 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Gippsland Basin Uncertainty Study
Step1: The Gippsland Basin Model
In this example we will apply the UncertaintyAnalysis class we have been playing with in the previous example to a 'realis... | Python Code:
from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
%matplotlib inline
#import the ususal libraries + the pynoddy UncertaintyAnalysis class
import sys, os, pynoddy
# from pynoddy.experiment.UncertaintyAnalysis import UncertaintyAnalysis
# adjust some settings for... |
6,772 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Spence/Garcia, What Were the Odds of That?
post @ endlesspint.com
Step1: Coming into the Fight
source
Step2: Fight Night
source
Step3: A tale of two jabs
Step4: What about contact? "Ever... | Python Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib inline
from scipy.stats import binom, poisson, zscore
Explanation: Spence/Garcia, What Were the Odds of That?
post @ endlesspint.com
End of explanation
np.random.seed(8)
sim_cnt_poi = 10000
spence_... |
6,773 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
GWAS Tutorial
This notebook is designed to provide a broad overview of Hail's functionality, with emphasis on the functionality to manipulate and query a genetic dataset. We walk through a g... | Python Code:
import hail as hl
hl.init()
Explanation: GWAS Tutorial
This notebook is designed to provide a broad overview of Hail's functionality, with emphasis on the functionality to manipulate and query a genetic dataset. We walk through a genome-wide SNP association test, and demonstrate the need to control for con... |
6,774 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Simple Oscillator Example
This example shows the most simple way of using a solver.
We solve free vibration of a simple oscillator
Step2: We need a first order system, so convert the second... | Python Code:
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
from scikits.odes import ode
#data of the oscillator
k = 4.0
m = 1.0
#initial position and speed data on t=0, x[0] = u, x[1] = \dot{u}, xp = \dot{x}
initx = [1, 0.1]
Explanation: Simple Oscillator Example
This example ... |
6,775 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Low-latency item-to-item recommendation system - Orchestrating with TFX
Overview
This notebook is a part of the series that describes the process of implementing a Low-latency item-to-item r... | Python Code:
%load_ext autoreload
%autoreload 2
Explanation: Low-latency item-to-item recommendation system - Orchestrating with TFX
Overview
This notebook is a part of the series that describes the process of implementing a Low-latency item-to-item recommendation system.
This notebook demonstrates how to use TFX and A... |
6,776 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Comparison of bowtie, bowtie2, and kallisto
Step1: Data preparation
We will use some of Ben's Sjorgrens data for this. We will generate a random sample of 1 million reads from the full dat... | Python Code:
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
Explanation: Comparison of bowtie, bowtie2, and kallisto
End of explanation
names = ['QNAME', 'FLAG', 'RNAME', 'POS', 'MAPQ', 'CIGAR', 'RNEXT', 'PNEXT', 'TLEN', 'SEQ', 'QUAL']
... |
6,777 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Toplevel
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specif... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-2', 'toplevel')
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: IPSL
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: ... |
6,778 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
None of this is being used. Most of it was abandoned. Just some brainstorming on how to approach presenting the data and what metrics to use.
Change csv file to have a column label for the ... | Python Code:
def test():
print "testing to see if migrated repository works"
def dash():
print "-" * 20
# import libraries
import pandas as pd
import matplotlib.pyplot as plot
import matplotlib
matplotlib.style.use('ggplot')
import random as rng
import numpy as np
%matplotlib inline
# take a url of the csv or c... |
6,779 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Tutorial
Step1: Dataset
In this section we inspect the dataset, split it into a training and a test set, and prepare it for easy consuption with PyTorch-based data loaders. Model constructi... | Python Code:
import numpy as np
import os
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import torch
from torch.utils.data import DataLoader
from deep4cast.forecasters import Forecaster
from deep4cast.models import WaveNet
from deep4cast.datasets import TimeSeriesDataset
import deep4cast.tra... |
6,780 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Minimum-length least squares
This notebook shows how to solve a minimum-length least squares problem, which finds a minimum-length vector $x \in \mathbf{R}^n$ achieving small mean-square err... | Python Code:
!pip install --upgrade cvxpy
import cvxpy as cp
import numpy as np
Explanation: Minimum-length least squares
This notebook shows how to solve a minimum-length least squares problem, which finds a minimum-length vector $x \in \mathbf{R}^n$ achieving small mean-square error (MSE) for a particular least squar... |
6,781 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Application 2
Step1: Labelling data
Based on its trust value, we categorise the data entity into two sets
Step2: Having used the trust valuue to label all the data entities, we remove the ... | Python Code:
import pandas as pd
df = pd.read_csv("collabmap/depgraphs.csv", index_col='id')
df.head()
df.describe()
Explanation: Application 2: CollabMap Data Quality
Assessing the quality of crowdsourced data in CollabMap from their provenance
Goal: To determine if the provenance network analytics method can identify... |
6,782 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
First Last - SymPy
Step1: $$ \Large {\displaystyle f(x)=3e^{-{\frac {x^{2}}{8}}}} \sin(x/3)$$
Find the first four terms of the Taylor expansion of the above equation
Make a plot of the func... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
Explanation: First Last - SymPy
End of explanation
sp.init_printing()
x = sp.symbols('x')
my_x = np.linspace(-10,10,100)
Explanation: $$ \Large {\displaystyle f(x)=3e^{-{\frac {x^{2}}{8}}}} \sin(x/3)$$
Find the first f... |
6,783 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Toplevel
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specif... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccma', 'canesm5', 'toplevel')
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CCCMA
Source ID: CANESM5
Sub-Topics: Radiative Forcings.
Properties: 85... |
6,784 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<br><br><br><br><br><h1 style="font-size
Step1: <br><br>
<div style="color
Step2: <br><br><br><br>
<div style="color
Step3: <br><br><br><br>
<div style="color
Step4: <br><br><br><br>
<di... | Python Code:
import pandas as pd
from pyspark.mllib.clustering import KMeans, KMeansModel
from numpy import array
Explanation: <br><br><br><br><br><h1 style="font-size:4em;color:#2467C0">Welcome to Week 3</h1><br><br><br>
<div style="color:black;font-family: Arial; font-size:1.1em;line-height:65%">
<p style="line-heigh... |
6,785 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Excel Extractor
ETK's Excel Extractor is a cell-based extractor for extracting data from compatible spreadsheets.
Souce spreadsheet
The example spreadsheet file named alabama.xml and it has ... | Python Code:
import pprint
from etk.extractors.excel_extractor import ExcelExtractor
ee = ExcelExtractor()
variables = {
'value': '$col,$row'
}
raw_extractions = ee.extract('alabama.xls', '16tbl08al', ['C,7', 'M,33'], variables)
pprint.pprint(raw_extractions[:10]) # print first 10
Explanation: Excel Extractor
ETK'... |
6,786 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Speci... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-mm', 'ocnbgchem')
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-MM
Topic: Ocnbgchem
Sub-Topics: Tracers.
Prop... |
6,787 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
AutoML text sentiment analysis
Installation
Install the latest version of AutoML SDK.
Step1: Install the Google cloud-storage library as well.
Step2: Restart the Kernel
Once you've install... | Python Code:
! pip3 install google-cloud-automl
Explanation: AutoML text sentiment analysis
Installation
Install the latest version of AutoML SDK.
End of explanation
! pip3 install google-cloud-storage
Explanation: Install the Google cloud-storage library as well.
End of explanation
import os
if not os.getenv("AUTORUN"... |
6,788 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Visual Comparison Between Different Classification Methods in Shogun
Notebook by Youssef Emad El-Din (Github ID
Step1: <a id = "section1">Data Generation and Visualization</a>
Transformatio... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from modshogun import *
#Needed lists for the final plot
classifiers_linear = []*10
classifiers_non_linear = []*10
classifiers_names = []*10
fadings = []*10
Explanat... |
6,789 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 3</font>
Download
Step1: Condicional If
Step2: Condicionais Aninhados
Step3: Elif
Step4: Operadores Lógicos | Python Code:
# Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 3</font>
Download: http://github.com/dsacademybr
End of explanation
# Con... |
6,790 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Write your post here.
Step1: Next, I'll make a new dataframe with just SeaWiFS-wavelength Rrs and chl and delete this superset to save space
Step2: What is this '0-chl' business?
Step3: S... | Python Code:
from gplearn.genetic import SymbolicRegressor
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.utils.random import check_random_state
import numpy as np
import pandas as pd
import seaborn as sb
from matplotlib import pyplot as pl
from matplo... |
6,791 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Посмотрев на свой предыдущий ноутбук, я ощутила острое желание все переделать и реструктурировать.
Прошлая версия по сути была больше изготовлением кирпичиков, из которых сейчас уже я соберу... | Python Code:
import requests
import re
from bs4 import BeautifulSoup
import pandas as pd
import time
import numpy as np
def html_stripper(text):
return re.sub('<[^<]+?>', '', str(text))
Explanation: Посмотрев на свой предыдущий ноутбук, я ощутила острое желание все переделать и реструктурировать.
Прошлая версия по ... |
6,792 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
StackOverflow Question Multiclassification (Keras)
This example uses a dataset from stackoverflow, with the input being posts and predictions one of the possible classes. It's an adapted ver... | Python Code:
# Python 3.6
!pip install verta
!pip install wget
!pip install pandas
!pip install tensorflow==1.14.0
!pip install scikit-learn
!pip install lxml
!pip install beautifulsoup4
Explanation: StackOverflow Question Multiclassification (Keras)
This example uses a dataset from stackoverflow, with the input being ... |
6,793 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Advanced Logistic Regression in TensorFlow 2.0
Learning Objectives
Load a CSV file using Pandas
Create train, validation, and test sets
Define and train a model using Keras (including settin... | Python Code:
import os
import tempfile
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import sklearn
import tensorflow as tf
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.preprocessing... |
6,794 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Vocabulary
In the previous parts, you learned how matplotlib organizes plot-making by figures and axes. We broke down the components of a basic figure and learned how to create them. You als... | Python Code:
# %load exercises/3.1-colors.py
t = np.arange(0.0, 5.0, 0.2)
plt.plot(t, t, , t, t**2, , t, t**3, )
plt.show()
Explanation: Vocabulary
In the previous parts, you learned how matplotlib organizes plot-making by figures and axes. We broke down the components of a basic figure and learned how to create them. ... |
6,795 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Working with the python DyNet package
The DyNet package is intended for training and using neural networks, and is particularly suited for applications with dynamically changing network stru... | Python Code:
# we assume that we have the dynet module in your path.
# OUTDATED: we also assume that LD_LIBRARY_PATH includes a pointer to where libcnn_shared.so is.
import dynet as dy
# create a parameter collection and add the parameters.
m = dy.ParameterCollection()
pW = m.add_parameters((8,2))
pV = m.add_parameters... |
6,796 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Assignment 12
1) Finalize figures(Bijan
Step1: Make a higher definition graph
Step2: It seems clear that the data changes across y. Let's look at the magnitude of these changes.
Step3: Ne... | Python Code:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
%matplotlib inline
import urllib2
import numpy as np
np.set_printoptions(precision=3, suppress=True)
url = ('https://raw.githubusercontent.com/Upward-Spiral-Science'
'/data/master/syn-density/output.csv')
data = urllib2.urlopen(... |
6,797 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Movie Review Sentiment Analysis
This notebook creates a logistic regression, svm, and naive bayes classifier from training data to train these model.
in this motebok data that we are using h... | Python Code:
import csv
from sklearn.linear_model import LogisticRegression as LR
from sklearn import svm
from sklearn.naive_bayes import BernoulliNB
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import cross_validation
from sklearn... |
6,798 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Table of Contents
<p><div class="lev1 toc-item"><a href="#Indexando-o-raster-de-um-array-usando-strides" data-toc-modified-id="Indexando-o-raster-de-um-array-usando-strides-1"><span class="t... | Python Code:
import numpy as np
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Indexando-o-raster-de-um-array-usando-strides" data-toc-modified-id="Indexando-o-raster-de-um-array-usando-strides-1"><span class="toc-item-num">1 </span>Indexando o raster de um array usando strides</a></d... |
6,799 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Нулевая гипотеза о стационарности временного ряда уверенно отклоняется тестом Тест Дики — Фуллера
Попробуем востановить стационарность, наивно, но два воспользуемся двумя способами
Step1: Д... | Python Code:
# возьмем лог, который "penalize higher values more than smaller values"
ts_log = np.log(rub["Adj Close"])
test_stationarity(ts_log)
# далее вычтем скользящее среднее
moving_avg = pd.rolling_mean(ts_log,50)
plt.plot(ts_log)
plt.plot(moving_avg, color='red')
ts_log_moving_avg_diff = ts_log - moving_avg
ts_l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.