Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
13,000
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import glob import tabulate import pprint import click import numpy as np import pandas as pd from ray.tune.commands import * from nupi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Load and check data Step2: ## Analysis Step3: Does improved weight pruning outperforms regular SET Step4: Results not in line with what the p...
13,001
<ASSISTANT_TASK:> Python Code: import numpy as np import keras from keras.datasets import mnist # Load the datasets (X_train, y_train), (X_test, y_test) = mnist.load_data() # What is the type of X_train? # What is the type of y_train? # Find number of observations in training data # Find number of observations in test...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Basic data analysis on the dataset Step2: Display Images
13,002
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 !pip install -q -U kfp import os os.environ['PROJECT_ID'] = 'yourProject' # Set your project. os.environ['BUCKET'] = 'yourBucket' # Set your bucket. os.environ['GKE_CLUSTER_NAME'] = 'yourCluster' # Set your GKE cluster name. os.environ['GKE_CLUSTER_ZONE...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Set environment variables Step2: Run the Pipeline locally by using the Beam runner Step3: Build the container image Step4: Compile the TFX pi...
13,003
<ASSISTANT_TASK:> Python Code: 5 == 5 5 == 4 1 == 1.0 5 == '5' 2 + 1 == 3 2 ** 3 - 1 == 8 - 1 'a' == 'a' 'Hello Buya' == "Hello Buya" 'hello buya' == 'Hello Buya' type(True) type(False) 5 == 3 1 != 1 5 > 3 5 < 3 'hello' == 'Hello' 'MARIO' == 'MARIO ' 1.5 == 1 1.0 == 1 1 == 1.0 5 != 7 - 2 5 >= 5.0 '5' > '24' # ראו אז...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <p style="text-align Step2: <p style="text-align Step3: <div class="align-center" style="display Step4: <p style="text-align
13,004
<ASSISTANT_TASK:> Python Code: %matplotlib inline from ecell4 import * import matplotlib.pylab as plt import numpy as np import seaborn seaborn.set(font_scale=1.5) import matplotlib as mpl mpl.rc("figure", figsize=(6, 4)) def Hill(E, Km, nH): return E ** nH / (Km ** nH + E ** nH) data = np.array([[Hill(A, 0.5, 8) ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: ブール演算 Step2: 試すと Step3: ORゲート Step4: 複雑に見えるが、$K_1=K_2$かつ$n_1=n_2$の場合を考えればヒル式と同じ Step5: 実は分解を制御しても似たようなことはできる Step6: 上の式においてA、Bがそれぞれ0もしくは十分に...
13,005
<ASSISTANT_TASK:> Python Code: import pandas as pd pd.Series? animales = ['Tigre', 'Oso', 'Camello'] pd.Series(animales) numeros = [1, 2, 3] pd.Series(numeros) animales = ['Tigre', 'Oso', None] pd.Series(animales) numeros = [1, 2, None] pd.Series(numeros) import numpy as np np.nan == None np.nan == np.nan print(np....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <br> Step2: <br> Step3: <br> Step4: <br> Step5: <br> Step6: <br> Step7: <br> Step8: <br> Step9: Búsqueda en una Serie Step10: <br> Step...
13,006
<ASSISTANT_TASK:> Python Code: %pylab inline import this import numpy as np np.array([1,2,3]) a = np.array([[1,2,3], [4,5,6]]) a = np.array([1,2,3]) b = np.array([4,5,6]) a+b a*b a/b a**b np.array([1, 2, 4], dtype=np.float32) a = np.array([1,2,3]) print(a.dtype) print(a.astype(np.float64).dtype) np.arange(2, 10, 3, ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Красивое лучше, чем уродливое.<br> Step2: Типы данных в np.array Step3: Создание массивов в numpy Step4: Заполнение массива Step5: Случайные...
13,007
<ASSISTANT_TASK:> Python Code: import pandas as pd catsData = pd.read_csv('../data/cats.csv') catsData.head() %matplotlib inline import matplotlib.pyplot as plt catsData.Hwt.hist() import numpy as np normal_samples = np.random.normal(loc=-2, scale=0.5, size=500) %matplotlib inline plt.hist(normal_samples) print 'Perc...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: The histogram tells us a few things Step2: <img src="Normal_Distribution_PDF.svg">
13,008
<ASSISTANT_TASK:> Python Code: import pandas as pd import matplotlib.pyplot as plt % matplotlib inline df = pd.read_csv('water_data_class.csv', encoding='latin-1') df # only countries with more than 25 million inhabitants and those who have values in every column (2002 that one with most non-values) big_ones = df[df['p...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 1) What is the average renewable freshwater resource? Step2: 2) What is the average withdrawl rate in 2014? Step3: 3) Which are the 5 countrie...
13,009
<ASSISTANT_TASK:> Python Code: import datetime # scientific python add-ons import numpy as np import pandas as pd # plotting stuff # first line makes the plots appear in the notebook %matplotlib inline import matplotlib.pyplot as plt # seaborn makes your plots look better try: import seaborn as sns sns.set(rc=...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: SPA output Step2: Speed tests Step3: This numba test will only work properly if you have installed numba. Step4: The numba calculation takes ...
13,010
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-1', 'toplevel') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 2...
13,011
<ASSISTANT_TASK:> Python Code: # Import the pandas and numpy libraries import pandas as pd import numpy as np # Read a file with an absolute path ufo = pd.read_csv('/Users/josiahdavis/Documents/GitHub/python_data_analysis/ufo_sightings.csv') # Alterntively, read the the file using a relative path ufo = pd.read_csv('ufo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Summarize the data that was just read in Step2: Filtering and Sorting Data Step3: Sorting Step4: Modifying Columns Step5: Handling Missing V...
13,012
<ASSISTANT_TASK:> Python Code: display(mglearn.plots.plot_logistic_regression_graph()) display(mglearn.plots.plot_single_hidden_layer_graph()) display(mglearn.plots.plot_two_hidden_layer_graph()) from sklearn.neural_network import MLPClassifier from sklearn.model_selection import train_test_split from sklearn.datase...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: MLP feedforward neural network Step2: Parameter Step3: Tuning Neural Networks Step4: MLP with two layers for smoother boundary Step5: L2 Pen...
13,013
<ASSISTANT_TASK:> Python Code: def hello(a,b): return a+b # Lazy definition of function hello(1,1) hello('a','b') class Person: def __init__(self,age,salary): self.age = age self.salary = salary def out(self): print(self.age) print(self.salary) a = Person(30,10000) a.out() ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Class Step2: This is a basic class definition, the age and salary are needed when creating this object. The new class can be invoked like this ...
13,014
<ASSISTANT_TASK:> Python Code: import os from pathlib import Path testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_09') if not os.path.exists(testfolder): os.makedirs(testfolder) print ("Your simulation will be stored in %s" % testfolder) # VARIABLES of the simulation: lat...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <a id='step1a'></a> Step2: <a id='step1b'></a> Step3: <a id='step1c'></a> Step4: <a id='step1d'></a> Step5: <a id='step2'></a> Step6: <a id...
13,015
<ASSISTANT_TASK:> Python Code: import os import glob import re import nestly %load_ext rpy2.ipython %%R library(ggplot2) library(dplyr) library(tidyr) library(gridExtra) library(phyloseq) ## BD for G+C of 0 or 100 BD.GCp0 = 0 * 0.098 + 1.66 BD.GCp100 = 1 * 0.098 + 1.66 workDir = '/home/nick/notebook/SIPSim/dev/fullCyc...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Nestly Step2: Checking amplicon fragment BD distribution Step3: fragments w/ diffusion + DBL Step4: BD min/max Step5: Plotting number of tax...
13,016
<ASSISTANT_TASK:> Python Code: from sklearn import datasets X, y = datasets.make_hastie_10_2(n_samples=12000, random_state=1) #make random test and train set from sklearn import cross_validation from sklearn.cross_validation import train_test_split train_x, test_x, train_y, test_y = train_test_split(X, y, test_size=0.3...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Neural Network Step2: If you already trained the dataset there will be a pickle file with the trained network available. Now underneath we test...
13,017
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.style.use('fivethirtyeight') df = pd.read_csv('data/historical_loan.csv') df.head() df.years = df.years.fillna(np.mean(df.years)) #Load the preprocessing module from sklearn import preprocessing...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Preprocessing the Data Step2: Accuracy Metrics Step3: Build Models and Evaluate Step4: Decision Tree Model - Shallow Step5: Decision Tree Mo...
13,018
<ASSISTANT_TASK:> Python Code: sigmoid = lambda x: 1/(1+np.exp(-x)) sigmoid_prime = lambda x: sigmoid(x)*(1-sigmoid(x)) xx = np.linspace(-10, 10, 1000) plt.plot(xx, sigmoid(xx)); plt.plot(xx, sigmoid_prime(xx)); %cd /home/dockeruser/neural-networks-and-deep-learning/src %ls import mnist_loader import network2 training...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 교차 엔트로피 오차 함수 (Cross-Entropy Cost Function) Step6: 과최적화 문제 Step10: Hyper-Tangent Activation and Rectified Linear Unit (ReLu) Activation Step11...
13,019
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'atmos') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 1...
13,020
<ASSISTANT_TASK:> Python Code: %pwd import pandas as pd names2010 = pd.read_csv('/resources/yob2010.txt', names=['name', 'sex', 'births']) names2010 names2010.groupby('sex').births.sum() def add_prop(group): # Integer division floors births = group.births.astype(float) group['prop'] = births / births.sum...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: http Step2: Total number of birth in year 2010 by sex Step3: Insert prop column for each group Step4: Verify that the prop clumn sums to 1 wi...
13,021
<ASSISTANT_TASK:> Python Code: %run db2.ipynb %%sql -q CREATE FUNCTION SYSTOOLS.JSON_TABLE( INJSON BLOB(16M), INELEM VARCHAR(2048), RETTYPE VARCHAR(100)) RETURNS TABLE(TYPE INTEGER, VALUE VARCHAR(2048)) LANGUAGE C PARAMETER STYLE SQL PARAMETER CCSID UNICODE NO SQL NOT FENCED DETERMINISTIC NO EXTERNA...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Table of Contents Step2: Back to Top Step3: If SYSTOOLS is not part of the path, you can update it with the following SQL. Step4: From this p...
13,022
<ASSISTANT_TASK:> Python Code: #Uplaod the data into the notbook and select the rows that will be used after previous visual inspection of the datasets datadir = 'D:/Users/Borja.gonzalez/Desktop/Thinkful-DataScience-Borja' gatrain = pd.read_csv('gender_age_train.csv',usecols=['device_id','gender','age','group'] ) gates...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 2. Dataset Creation Step2: The dataset stands as follows. There are more than 2.8 million entries being all the values of the cells integers St...
13,023
<ASSISTANT_TASK:> Python Code: %matplotlib inline import glob from sympy import * import numpy import matplotlib.pyplot as plt import pandas init_printing() x,t,a,b= symbols('x t a b') u = 1+a*exp(1/(10*t))*sin(2*pi/b*x) u f = diff(u, t) + diff(u, x) f str(u).replace('**', '^') str(f).replace('**', '^') filenames ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Define the Manufactured solution Step2: Compute the forcing function. Step3: Build a string of the exact and forcing function to be copied to ...
13,024
<ASSISTANT_TASK:> Python Code: # In IPython or the IPython notebook, it's easiest to use the pylab magic, which # imports matplotlib, numpy, and scipy. # The matplotlib notebook flag means that plots will be shown interactively in the # notebooks, rather than in pop-up windows. %matplotlib notebook import numpy as np i...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 2. Creating Figures Step2: First, create an empty figure with 2 subplots Step3: Now let's actually plot the data using the plot method on an a...
13,025
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.display import Image from IPython.html.widgets import interact, interactive, fixed Image('fermidist.png') def fermidist(energy, mu, kT): Compute the Fermi distribution at energy, mu and kT. return...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Exploring the Fermi distribution Step3: In this equation Step4: Write a function plot_fermidist(mu, kT) that plots the Fermi distribution $F(\...
13,026
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt np.random.seed(seed=1) import math try: import torch except ModuleNotFoundError: %pip install -qq torch import torch from torch import nn from torch.nn import functional as F from torch.utils import data !mkdir figures # for s...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: Please find jax implementation of this notebook here Step4: Basics Step6: Tokenization Step9: Vocabulary Step10: Here are the top 10 words (...
13,027
<ASSISTANT_TASK:> Python Code: !pip install git+https://github.com/openai/baselines > ~/pip_install_baselines.log !OPENAI_LOGDIR=$HOME/logs/cartpole-ppo OPENAI_LOG_FORMAT=csv python -m baselines.run --alg=ppo2 --env=CartPole-v0 --num_timesteps=30000 --nsteps=128 from baselines.common import plot_util as pu results = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: For all algorithms in baselines summary data is saved into a folder defined by logger. By default, a folder $TMPDIR/openai-<date>-<time> is used...
13,028
<ASSISTANT_TASK:> Python Code: #Importation des librairies utilisées import unicodedata import time import pandas as pd import numpy as np import random import nltk import re import collections import itertools import warnings warnings.filterwarnings("ignore") import matplotlib.pyplot as plt import seaborn as sb sb.s...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: nltk Step2: Les données Step3: Bien que déjà réduit par rapport au fichier original du concours, contenant plus de 15M de lignes, le fichier c...
13,029
<ASSISTANT_TASK:> Python Code: %matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display def print_sum(a, b): Print the sum of the arguments a and b. print(a+b) interact(print_sum, a=(-10.0,10.0,...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: Interact basics Step3: Use the interact function to interact with the print_sum function. Step5: Write a function named print_string that prin...
13,030
<ASSISTANT_TASK:> Python Code: %matplotlib inline x_axis = np.arange(0+1, len(historical)+1) plt.plot(x_axis, historical_opening, 'b', x_axis, historical_closing, 'r') plt.xlabel('Day') plt.ylabel('Price ($)') #plt.figure(figsize=(20,10)) plt.title("Stock price: Opening vs Closing") plt.show(); plt.plot(x_axis, histo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Historical opening, closing, high, low Step2: Volume vs Average Volume Step3: Convert the data collected into numpy arrays Step4: Stack the d...
13,031
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import h5py import scipy from PIL import Image from scipy import ndimage # from ..data.deeplearningai17761.lr_utils import load_dataset def load_dataset(): train_dataset = h5py.File('../data/deeplearningai17761/train_catvnoncat.h5', "...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 深度学习中的许多报错都来自于矩阵/向量尺寸不匹配。 如果你可以保持矩阵/向量的尺寸不变,那么将消除大多错误。 Step2: 预处理数据集的常见步骤是: Step5: 建立神经网络的主要步骤是: 1.定义模型结构(例如输入特征的数量) 2.初始化模型的参数 3.循环: Step7: ...
13,032
<ASSISTANT_TASK:> Python Code: from collections import Counter, defaultdict from functools import partial import math, random def entropy(class_probabilities): 클래스에 속할 확률을 입력하면 엔트로피를 계산하라 return sum(-p * math.log(p, 2) for p in class_probabilities if p) #각 클래스 레이블의 확률은 별도로 계산 #엔트로피를 구할 때는 어떤 레이블에 어떤 확률값이 주어졌는지까...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 17. decision trees Step3: 파티션의 엔트로피 Step6: 의사결정나무 만들기 Step8: ~~~ Step9: 이제 학습용 데이터로부터 실제 나무를 구축!!! Step10: 랜덤포레스트
13,033
<ASSISTANT_TASK:> Python Code: from os import path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.forward import make_forward_dipole from mne.evoked import combine_evoked from mne.simulation import simulate_evoked from nilearn.plotting import plot_anat from nilearn.datasets import load_mni...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Let's localize the N100m (using MEG only) Step2: Calculate and visualise magnetic field predicted by dipole with maximum GOF Step3: Estimate t...
13,034
<ASSISTANT_TASK:> Python Code: import logging import time import numpy as np import scipy.stats as ss import matplotlib.pyplot as plt import sklearn import pandas as pd from sklearn import datasets from sklearn import svm import pylab as pl from matplotlib.colors import ListedColormap import sklearn as sk from sklearn...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Les modules suivants vous avez installées avec pip à partir de requirements.txt. Ou bien vous avez installé anaconda (Mac ou Windows), et dans ...
13,035
<ASSISTANT_TASK:> Python Code: import asyncio loop = asyncio.get_event_loop() def hello_world(): print('Hello World!') loop.stop() loop.call_soon(hello_world) loop.run_forever() async def aprint(text): await asyncio.sleep(1) print(text) return 42 loop.run_until_complete(aprint('Hello world!')) as...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Run a simple callback as soon as possible Step2: Coroutine Examples Step3: You can use as many awaits as you like in a couroutine Step4: All ...
13,036
<ASSISTANT_TASK:> Python Code: fileh5 = '/home/alessio/Desktop/Noise_Or_Not/m-only_IR_longer_with_nac_2_1_0000/allInput.h5' inp = qp.readWholeH5toDict(fileh5) wf2 = np.zeros_like(inp['potCube'],dtype=complex) allp,allg,allt,alls = wf2.shape wf = wf2[:,:,:,0].reshape(allp,allg,allt,1) dime = allp*allg*allt print(dime,al...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Title Step2: This is along phi. I take the G element of the kin matrix corresponding to the second derivative. Step3: column or rows?
13,037
<ASSISTANT_TASK:> Python Code: import sympy as sym sym.init_printing() x, y = sym.symbols('x y') expr = 3*x**2 + sym.log(x**2 + y**2 + 1) expr expr.subs({x: 17, y: 42}).evalf() %timeit expr.subs({x: 17, y: 42}).evalf() import math f = lambda x, y: 3*x**2 + math.log(x**2 + y**2 + 1) f(17, 42) %timeit f(17, 42) g = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We will look at an arbitrary expression $f(x, y)$ Step2: One way to evaluate above expression numerically is to invoke the subs method followed...
13,038
<ASSISTANT_TASK:> Python Code: # Like this first line, anything following a hash character (for the rest of that line) is considered a comment, and won't be run as code text_str = "Congratulations, you've just run some Python code!" print(text_str) print(text_str) text = "Weill Cornell Medicine" # An example of a...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: You will notice that the output of the cell is placed immediately underneath the cell, and that a number appears to the left of the cell to indi...
13,039
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import glob import tabulate import pprint import click import numpy as np import pandas as pd from ray.tune.commands import * from nupi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Load and check data Step2: ## Analysis Step3: Results
13,040
<ASSISTANT_TASK:> Python Code: def cnv2utf8(mstr): #print mstr #print urllib.quote(mstr.encode(u"utf8")) return urllib.quote(mstr.encode(u"utf8")) class MyPrettyPrinter(pprint.PrettyPrinter): def format(self, object, context, maxlevels, level): if isinstance(object, unicode): return...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 可以看json中文字的程式碼 Step2: 傳入六個變數,回傳一個Json Step3: url = u"http
13,041
<ASSISTANT_TASK:> Python Code: import torch import numpy as np import math import matplotlib.pyplot as plt num_samples = 7 torch.manual_seed(123) order = 3 W_gnd = torch.randn(order + 1) left = -3 right = 3 variance = torch.randn(1)[0] * 10 # print('variance', variance) # help(torch.arange) x1 = torch.arange(left, righ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Looking at https Step2: sample from the dist
13,042
<ASSISTANT_TASK:> Python Code: x = -3 if x > 0: print("Value is positive") elif x < 0: print("Value is negative") else: print("Value is zero") gene = "BRCA2" geneExpression = -1.2 if geneExpression < 0: print(gene, "is downregulated") elif geneExpression > 0: print(gene, "is upregulated") ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: The general form of writing out such combined conditional statements is as follows Step2: For very simple conditional checks, you can write the...
13,043
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt # You can add anything you need as you work F_META = '../Day2/dsfp_ztf_meta.npy' F_FEATS = '../Day2/dsfp_ztf_feats.npy' D_STAMPS = '../Day2/dsfp_ztf_png_stamps' meta_np = np.load(F_META) feats_np =...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 0b. Data Location Step2: 0c. Load Data
13,044
<ASSISTANT_TASK:> Python Code: import os import sys import numpy as np import matplotlib.pyplot as plt from desiutil.log import get_logger, DEBUG log = get_logger() import seaborn as sns sns.set(style='white', font_scale=1.1, palette='Set2') %matplotlib inline healpixel = 26030 nside = 64 seed = 555 rand = np.random....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: To keep the calculations below manageable we specify a single nside=64 healpixel in an arbitrary location of the DESI footprint. Step2: Specify...
13,045
<ASSISTANT_TASK:> Python Code: !pip install -U sklearn import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import sklearn as skl import sklearn.linear_model as lm import scipy.io as sio !pip install -U okpy from client.api.notebook import Notebook ok = Noteboo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Today's lab covers Step2: Let's load in the data Step3: Question 1 Step4: Question 2 Step5: Question 4 Step6: Question 5 Step7: Question 6...
13,046
<ASSISTANT_TASK:> Python Code: truth = "This is some text.\nMore text, but on a different line!\nInsert your favorite meme here.\n" pred = read_file_contents("q1data/file1.txt") assert truth == pred retval = -1 try: retval = read_file_contents("nonexistent/path.txt") except: assert False else: assert retval...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Part B Step2: Part C
13,047
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm data_dir = 'data/' if not isdir(data_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Getting the data Step2: These SVHN files are .mat files typically used with Matlab. However, we can load them in with scipy.io.loadmat which we...
13,048
<ASSISTANT_TASK:> Python Code: import stix2 from stix2 import AttackPattern, Environment, MemoryStore env = Environment(store=MemoryStore()) ap1 = AttackPattern( name="Phishing", external_references=[ { "url": "https://example2", "source_name": "some-source2", }, ], )...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Campaign Example Step2: Identity Example Step3: Indicator Example Step4: If the patterns were identical the result would have been 100. Step5...
13,049
<ASSISTANT_TASK:> Python Code: a = 10 print(a) import time time.sleep(10) import sys from ctypes import CDLL # This will crash a Linux or Mac system # equivalent calls can be made on Windows # Uncomment these lines if you would like to see the segfault # dll = 'dylib' if sys.platform == 'darwin' else 'so.6' # libc = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: There are two other keyboard shortcuts for running code Step2: If the Kernel dies you will be prompted to restart it. Here we call the low-leve...
13,050
<ASSISTANT_TASK:> Python Code: import pandas as pd df = pd.DataFrame({'codes':[[71020], [77085], [36415], [99213, 99287], [99234, 99233, 99233]]}) def g(df): for i in df.index: df.loc[i, 'codes'] = sorted(df.loc[i, 'codes']) df = df.codes.apply(pd.Series) cols = list(df) for i in range(len(cols)...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
13,051
<ASSISTANT_TASK:> Python Code: #from imp import * #s=load_source('sygma','/home/nugrid/nugrid/SYGMA/SYGMA_online/SYGMA_dev/sygma.py') %pylab nbagg import sygma as s reload(s) print s.__file__ #import matplotlib #matplotlib.use('nbagg') #import matplotlib.pyplot as plt #matplotlib.use('nbagg') #import numpy as np from s...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Pick two isotopes, H-1 and Fe-56 and check total production Step2: Note Step3: SNII and SNIa
13,052
<ASSISTANT_TASK:> Python Code: x = 12 y = 10 z = x + y x = x + y y = z + y x = 1 + 2 * 3 / 4 y = (1 + 2) * (3 / 4) z = 1 + 2 * (3 / 4) print(x) print(y) print(z) pi = 3.141592653589793 r = 12 / 2 vol = (4/3) * pi * (r**3) print(vol) vol=14137 r3 = vol / ((4/3) * pi) r = r3**(1/3) print(round(r)) hours=10 if hours >...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Once you have calculated what you think x, y and z are, add print statements to the code above and run it to check. Make sure you understand the...
13,053
<ASSISTANT_TASK:> Python Code: sess = tf.Session() print(str(sess.run(hello),encoding = "utf-8")) # print(sess.run(hello)) sess.close() a = tf.constant(1234, dtype=tf.float32) b = tf.constant(5000, dtype=tf.float32) print(a) print(b) add_op = a + b print(add_op) with tf.Session() as sess: print(sess.run(add_op)) ad...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 마크다운으로 메모 작성하기...!
13,054
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import matplotlib.collections import geopandas as gpd import open_cp.network import open_cp.sources.chicago import open_cp.geometry #data_path = os.path.join("/media", "disk", "Data") data_path = os.path.join("..", "..", "..", "..", "..",...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Geometry Step2: Event data Step3: Save for later Step4: With old data
13,055
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'inpe', 'besm-2-7', 'atmos') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "email...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 1...
13,056
<ASSISTANT_TASK:> Python Code: df=pd.read_csv("311-2014.csv", nrows=200000) dateutil.parser.parse(df['Created Date'][0]) def parse_date(str_date): return dateutil.parser.parse(str_date) df['created_datetime']=df['Created Date'].apply(parse_date) df.index=df['created_datetime'] df['Complaint Type'].describe() df.g...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: What was the most popular type of complaint, and how many times was it filed? Step2: Make a horizontal bar graph of the top 5 most frequent com...
13,057
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import requests as req import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_ind, ttest_rel from scipy.stats import gaussian_kde from statsmodels.formula.api import ols, mixedlm, gee from statsmodels.s...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Carregando dados de IDH-M da Wikipedia Step2: Análise Step3: Testando hipótese Step4: A resposta de diversos testes, para um nível de 5% de s...
13,058
<ASSISTANT_TASK:> Python Code: APIKEY="AIzaSyBQrrl4SZhE3QtxsnbjY2WTdgcBz0G0Rfs" # CHANGE print APIKEY PROJECT_ID = "qwiklabs-gcp-14067121d7b1d12c" # CHANGE print PROJECT_ID BUCKET = "qwiklabs-gcp-14067121d7b1d12c" # CHANGE import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT_ID from googleapicl...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <h2> Define an API calling function </h2> Step2: <h2> Test the Sentiment Analysis </h2> Step3: <h2>Use the Dataproc cluster to run a Spark job...
13,059
<ASSISTANT_TASK:> Python Code: ciphertxt = open('cipher.txt', 'r') cipher = ciphertxt.read().split(',') #Splits the ciphertxt into a list, splits at every , cipher = [int(i) for i in cipher] ciphertxt.close() search = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Below are the lists I created that will help me narrow my search. I created the list called search because the key was only allowed to contain 3...
13,060
<ASSISTANT_TASK:> Python Code: %%bash source activate py2env pip uninstall -y google-cloud-dataflow conda install -y pytz==2018.4 pip install apache-beam[gcp] tensorflow_transform==0.8.0 %%bash pip freeze | grep -e 'flow\|beam' import tensorflow as tf import apache_beam as beam print(tf.__version__) # change these to ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: You need to restart your kernel to register the new installs running the below cells Step3: <h2> Save the query from earlier </h2> Step4: <h2>...
13,061
<ASSISTANT_TASK:> Python Code: % matplotlib inline from numpy import zeros, zeros_like, ones, vstack, mod, loadtxt import matplotlib.pyplot as plt from numpy.linalg import pinv def h(theta, x): y_estimated = 0. for theta_i, x_i in zip(theta, x): y_estimated += theta_i*x_i return y_estimated def J(t...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Introduction et notations Step2: Application Step3: Nous sommes pour l'instant intéressé uniquement par les années en poste et les salaires. O...
13,062
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt from scipy import sparse % matplotlib inline import scipy.stats as stats import statsmodels.api as sm import CompModel_v7 as cm cm = reload(cm) import multiprocessing as mp import sklearn.preprocessing as preprocessing import sklearn.svm ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Simulate Tasks Step2: 3.0.1a visualize synaptic matrix (sample subject) Step3: 3.0.1 Visualize actual estimated 'intrinsic FC's from Pearson F...
13,063
<ASSISTANT_TASK:> Python Code: %matplotlib notebook import os import sys import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import (MultipleLocator, FormatStrFormatter, AutoMinorLocator) import pandas as pd os.getcwd() os.chdir('..') os.getcwd() sys.path.append('../scripts') import bicorr_plot a...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Move up a directory for easier access Step2: Find the other data Step3: Which do I want to plot on the same distribution? Step4: General plot...
13,064
<ASSISTANT_TASK:> Python Code: import torch as T import torch.autograd from torch.autograd import Variable import numpy as np ''' Define a scalar variable, set requires_grad to be true to add it to backward path for computing gradients It is actually very simple to use backward() first define the computation graph, th...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Simplicity of using backward() Step2: The simple operations defined a forward path $z=(2x)^3$, $z$ will be the final output Variable we would l...
13,065
<ASSISTANT_TASK:> Python Code: import pints import pints.toy import numpy as np import matplotlib.pyplot as plt # Create log pdf log_pdf = pints.toy.NealsFunnelLogPDF() # Plot marginal density levels = np.linspace(-7, -1, 20) x = np.linspace(-10, 10, 100) y = np.linspace(-10, 10, 100) X, Y = np.meshgrid(x, y) Z = [[log...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We can also sample independently from this toy LogPDF, and add that to the visualisation Step2: We now try to sample from the distribution with...
13,066
<ASSISTANT_TASK:> Python Code: %matplotlib inline #the above call us to display the seaborn plots within the IPython notebook import pandas as pd import matplotlib.pyplot as plt import seaborn as sns data = pd.read_csv("/Users/.../Machine Learning Competitions/Kaggle/Right Whale Recognition Challenge/features/rgbHisto...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: As you can see, the images in the Kaggle data set are far from being evenly distributed. Many classes have fewer than ten observations while, on...
13,067
<ASSISTANT_TASK:> Python Code: # Uncomment to install required python modules # !sh ../utils/setup.sh # Add custom utils module to Python environment import os import sys sys.path.append(os.path.abspath(os.pardir)) from gps_building_blocks.cloud.utils import bigquery as bigquery_utils from utils import model from utils...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Set paramaters Step2: Next, let's configure modeling options. Step3: Train the model Step4: Next cell triggers model training job in BigQuery...
13,068
<ASSISTANT_TASK:> Python Code: import pandas as pd import ext_datos as ext import procesar as pro import time_plot as tplt dia1 = ext.extraer_data('dia1') cd .. dia2 = ext.extraer_data('dia2') cd .. dia3 = ext.extraer_data('dia3') cd .. dia4 = ext.extraer_data('dia4') motoresdia1 = pro.procesar(dia1) motoresdia2 = p...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Importamos las librerías creadas para trabajar Step2: Generamos los datasets de todos los días Step3: Se procesan las listas anteriores, se co...
13,069
<ASSISTANT_TASK:> Python Code: MODEL_NAME = 'class-model-01' TRAIN_DATA_FILES_PATTERN = 'data/train-*.tfrecords' VALID_DATA_FILES_PATTERN = 'data/valid-*.tfrecords' TEST_DATA_FILES_PATTERN = 'data/test-*.tfrecords' RESUME_TRAINING = False PROCESS_FEATURES = True EXTEND_FEATURE_COLUMNS = True MULTI_THREADING = True HEA...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 1. Define Dataset Metadata Step2: 2. Define Data Input Function Step3: b. Data pipeline input function Step4: 3. Define Feature Columns Step5...
13,070
<ASSISTANT_TASK:> Python Code: from openhunt.mordorutils import * spark = get_spark() mordor_file = "https://raw.githubusercontent.com/OTRF/mordor/master/datasets/small/windows/execution/host/empire_launcher_vbs.zip" registerMordorSQLTable(spark, mordor_file, "mordorTable") df = spark.sql( ''' SELECT `@timestamp`, Ho...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Download & Process Mordor Dataset Step2: Analytic I Step3: Analytic II Step4: Analytic III Step5: Analytic IV Step6: Analytic V Step7: Ana...
13,071
<ASSISTANT_TASK:> Python Code: DON'T MODIFY ANYTHING IN THIS CELL import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) view_sentence_range = (5, 10) DON'T MODIFY AN...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Language Translation Step3: Explore the Data Step6: Implement Preprocessing Function Step8: Preprocess all the data and save it Step10: Chec...
13,072
<ASSISTANT_TASK:> Python Code: import numpy as np np.random.seed(42) # Setting the random seed # a vector: the argument to the array function is a Python list v = np.random.rand(10) v # a matrix: the argument to the array function is a nested Python list M = np.random.rand(10, 2) M # v is a vector, and has only one d...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We can index elements in an array using the square bracket and indices Step2: If we omit an index of a multidimensional array it returns the wh...
13,073
<ASSISTANT_TASK:> Python Code: some_global_variable = 6 def my_function(arg): This is a docstring. some_global_variable = 1 return some_global_variable print(my_function(5)) some_global_variable %time some_list = [x**x for x in range(9001)] !sudo python3.6 -m pip install matplotlib %matplotlib not...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <img src="resources/jupyter-main-logo.svg" alt="Jupyter" height="200" width="200"> Step3: Magic Step4: Bash Step5: HTML Step6: Embed YouTube...
13,074
<ASSISTANT_TASK:> Python Code: !pip install -I "phoebe>=2.2,<2.3" %matplotlib inline import phoebe from phoebe import u # units import numpy as np import matplotlib.pyplot as plt logger = phoebe.logger() b = phoebe.default_binary() print(b.get_parameter(qualifier='distance', context='system')) print(b.get_parameter(q...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: As always, let's do imports and initialize a logger and a new bundle. See Building a System for more details. Step2: Relevant Parameters Step3...
13,075
<ASSISTANT_TASK:> Python Code: from IPython.display import display import pandas %%writefile data.csv Date,Open,High,Low,Close,Volume,Adj Close 2012-06-01,569.16,590.00,548.50,584.00,14077000,581.50 2012-05-01,584.90,596.76,522.18,577.73,18827900,575.26 2012-04-02,601.83,644.00,555.00,583.98,28759100,581.48 2012-03-0...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Pandas Step2: Here is a small amount of stock data for APPL Step3: Read this as into a DataFrame Step4: And view the HTML representation Step...
13,076
<ASSISTANT_TASK:> Python Code: # Import libraries import numpy as np %config InlineBackend.figure_format = 'retina' %matplotlib inline import matplotlib.pyplot as plt kernel_fast = np.array([0, .5, 1, .8, .4, .2, .1, 0]) kernel_slow = np.hstack([np.arange(0,1,.2),np.arange(1,0,-.04)]) plt.figure(figsize=(5,6)) plt.sub...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 1. Define kernels of neuronal response to static gratings Step2: 2. Estimate neural response to preferred and opposite directions
13,077
<ASSISTANT_TASK:> Python Code: #@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/L...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <table class="tfo-notebook-buttons" align="left"> Step2: Sentences Step3: Run the model Step5: Semantic similarity
13,078
<ASSISTANT_TASK:> Python Code: %matplotlib inline from bigbang.archive import Archive from bigbang.archive import load as load_archive import bigbang.parse as parse import bigbang.graph as graph import bigbang.mailman as mailman import bigbang.process as process import networkx as nx import matplotlib.pyplot as plt imp...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Set a valid date frame for building the network. Step2: Filter data according to date frame and export to .gexf file
13,079
<ASSISTANT_TASK:> Python Code: import numpy as np import networkx as nx import seaborn as sns %matplotlib inline edges = np.genfromtxt('0.edges', dtype="int", delimiter=" ") G = nx.read_edgelist('0.edges', delimiter=" ") def total_edges(edges): return (len(G.nodes())*(len(G.nodes()-1)))/2 def p_edges(edges): re...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Ejercicios Comparación Tamaño del componente Gigante
13,080
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS from IPython.display import HTML from ipywidgets import interact HTML('../style/code_toggle.html') def FS_coeffs(x, m, func, T=2.0*np.pi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Import section specific modules Step3: 2.3. Fourier Series<a id='math Step4: That should be good enough for our purposes here. Next we create ...
13,081
<ASSISTANT_TASK:> Python Code: # Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt from __future__ import print_function # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a n...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We would now like to classify the test data with the kNN classifier. Recall that we can break down this process into two steps Step2: Inline Qu...
13,082
<ASSISTANT_TASK:> Python Code: blocks = [] # Define Neo blocks bl0 = neo.Block(name='First block') bl1 = neo.Block(name='Second block') bl2 = neo.Block(name='Third block') print("bl0.segments = ", bl0.segments) print("bl1.segments = ", bl1.segments) print("bl2.segments = ", bl2.segments) blocks = [bl0, bl1, bl2] ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Write a nwb file Step2: Read the NWB file Step3: Using Neo NWBIO
13,083
<ASSISTANT_TASK:> Python Code: #@test {"skip": true} !pip install --quiet --upgrade tensorflow-federated !pip install --quiet --upgrade nest-asyncio import nest_asyncio nest_asyncio.apply() import collections import time import tensorflow as tf import tensorflow_federated as tff source, _ = tff.simulation.datasets.emn...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: トレーニングするモデルの定義 Step2: リモートエグゼキュータのセットアップ Step3: トレーニングの実行
13,084
<ASSISTANT_TASK:> Python Code: # Load neccessary libraries changed pandas import for convinience %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification from sklearn.model_selection import cross_val_score from sklea...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Using 8 estimators (usage of one per core if 8 cores (jobs) are used) Step2: Plot of the training time in seconds of each RFC against the numbe...
13,085
<ASSISTANT_TASK:> Python Code: # get date of last tag from subprocess import Popen, PIPE x, err = Popen('git log -1 --tags --simplify-by-decoration --pretty="%ai"| cat', stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True).communicate() start_date = x.split()[0].decode('utf-8') start_date # today's date import datetime ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: This notebook will generate a file in the current directory with the name "changelog_VERSION.md". You can edit and append this on front of the C...
13,086
<ASSISTANT_TASK:> Python Code: print('Esto es un mensaje') # NOTA: en Python, las líneas que comienzan con # son comentarios # El intérprete no las lee. Los humanos sí deberíamos leerlas :-) mivariable = 34 edad = 25 year = 1992 print(mivariable) print(year) print('mivariable') print('year') print('El niño come manza...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Variables y tipos de datos Step2: En Python podemos utilizar como nombre de variable cualquier secuencia de caracteres alfanuméricos, siempre q...
13,087
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np cd /Users/grefe950/evolve/dmestar/trk/ def loadTrack(filename): return np.genfromtxt(filename, usecols=(0, 1, 2, 3, 4, 5)) masses = [0.1, 0.5, 1.0, 1.5] # directory extensions gs98_dir = 'gs98/p000/a0/amlt1884' ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Quick mass track loader Step2: Preliminary definitions, including masses and file extensions. Step3: It's quite curious as to why the GAS07 an...
13,088
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np dict = {'abc':'1/2/2003', 'def':'1/5/2017', 'ghi':'4/10/2013'} df = pd.DataFrame({'Member':['xyz', 'uvw', 'abc', 'def', 'ghi'], 'Group':['A', 'B', 'A', 'B', 'B'], 'Date':[np.nan, np.nan, np.nan, np.nan, np.nan]}) def g(dict, df): df["Date"] = df[...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
13,089
<ASSISTANT_TASK:> Python Code: def my_function(a, b): This function sum together two variables (if they are summable). return a + b my_function(2, 5) my_function("Spam ", "eggs") my_function([1, 2, "A"], [5, 5.3]) def my_function(arg1, arg2, kwarg1=0, kwarg2=0): This function accepts two...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Funkce a třídy Step2: Funkce může být opakovaně použita kde sčítání různých argumentů (čísel, textu i listů) Step4: Poznámka Step7: Třídy Ste...
13,090
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import torch lens = load_data() max_len = max(lens) mask = torch.arange(max_len).expand(len(lens), max_len) < lens.unsqueeze(1) mask = mask.type(torch.LongTensor) <END_TASK>
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
13,091
<ASSISTANT_TASK:> Python Code: from feature_selector import FeatureSelector import pandas as pd air_quality = pd.read_csv('data/AirQualityUCI.csv') air_quality['Date'] = pd.to_datetime(air_quality['Date']) air_quality['Date'] = (air_quality['Date'] - air_quality['Date'].min()).dt.total_seconds() air_quality['Time'] = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Air Quality Dataset Step2: Insurance Dataset
13,092
<ASSISTANT_TASK:> Python Code: from pandas import Series, DataFrame import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib %matplotlib inline weather = pd.read_table('data/daily_weather.tsv') stations = pd.read_table('data/stations.tsv') usage = pd.read_table('data/usage_2012.tsv') w...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: read in data Step2: repeat data fixing from previous exercise Step3: 1a. Plot the daily temperature over the course of the year. (This should ...
13,093
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_12a import * path = datasets.untar_data(datasets.URLs.IMDB) ll = pickle.load(open(path/'ll_lm.pkl', 'rb')) bs,bptt = 128,70 data = lm_databunchify(ll, bs, bptt) vocab = ll.train.proc_x[1].vocab # ! wget http://fil...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Data Step2: Finetuning the LM Step3: In our current vocabulary, it is very unlikely that the ids correspond to what is in the vocabulary used ...
13,094
<ASSISTANT_TASK:> Python Code: gPlayers = [0, 1] gStart = 0 def set_bits(Bits): result = 0 for b in Bits: result |= 1 << b # bitwise or 2**b return result "{:b}".format(set_bits([0, 1, 4])) assert set_bits([0, 1, 4]) == 2**0 + 2**1 + 2**4 def set_bit(n): return 1 << n assert set_bit(7) == 2 ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: States are represented as integers. The first 9 bits encode the marks of the player X, the next 9 bits encode the marks of the player O. Initi...
13,095
<ASSISTANT_TASK:> Python Code: # 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, sof...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Channel Attribution -- Building Blocks of Interpretability Step2: Setup (feel free to skip) Step3: BarsWidget Step4: Spritemaps Step5: Attri...
13,096
<ASSISTANT_TASK:> Python Code: from scipy import matrix, sqrt, pi, cos, sin, set_printoptions p0 = 2224.0 # converted from kN to Newton rho1 = 183E-6 ; rho2 = 368E-6 # converted from μm to m w1 = 16.0 ; w2 = 25.0 th1 = 15.0 ; th2 = 55.0 d2r = pi/180. cos1 = cos(d2r*th1) ; cos2 = cos(d2r*th2) sin1 = sin(d2r*th1) ; sin2 ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Determination of $\zeta$
13,097
<ASSISTANT_TASK:> Python Code: from __future__ import print_function, division import numpy import scipy.stats import matplotlib.pyplot as pyplot from IPython.html.widgets import interact, fixed from IPython.html import widgets # seed the random number generator so we all get the same results numpy.random.seed(17) # so...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: To explore statistics that quantify effect size, we'll look at the difference in height between men and women. I used data from the Behavioral ...
13,098
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd from sklearn import preprocessing from sklearn import metrics from sklearn.metrics import accuracy_score from sklearn.ensemble import AdaBoostClassifier from sklearn.neighbors import KNeighborsClassifier import xgboost as xgb import numpy as np kobe...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Loading data Step2: encoding catagorical features Step3: splitting data into test and train Step4: seperating features and class in both test...
13,099
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3-veg-lr', 'toplevel') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 2...