Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
5,300
<ASSISTANT_TASK:> Python Code: import pandas as pd from matplotlib import pyplot as plt %matplotlib inline # Set some parameters to apply to all plots. These can be overridden import matplotlib # Plot size to 14" x 7" matplotlib.rc('figure', figsize = (14, 7)) # Font size to 14 matplotlib.rc('font', size = 14) # Do 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: 2. Read Data Step2: 2.2 Global Temperature Anomalies Step3: 2.3 Merge CO2 and GTA into one dataframe Step4: 3. Visualize CO2 and GTA in one f...
5,301
<ASSISTANT_TASK:> Python Code: from functions import connect, forward, backward, stop, left, right, disconnect from time import sleep robot = 12 # canvieu pel número del vostre robot connect(robot) # i executeu, polsant Majúscules + Enter forward() sleep(1) stop() backward() sleep(1) stop() left() sleep(1) sto...
<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: Cap avant Step2: Cap arrere Step3: Esquerra Step4: Dreta Step5: Tot correcte? Fàcil, no? Anem a comprovar-ho amb el primer exercici, però ab...
5,302
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as mpl %matplotlib inline # just for presentation purposes import warnings warnings.filterwarnings("ignore") %%bash pip install pycupid from astropy.io import fits hdulist = fits.open('FITS/ALMA00000034.fits') hdulist.info() print('\nTarget Ob...
<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: Installing PyCupid is as easy as Step2: We load an Orion-KL FITS from ALMA SV with astropy Step3: Let's import PyCupid for doing some serious ...
5,303
<ASSISTANT_TASK:> Python Code: ht_samples = hl.import_table( "gs://hail-datasets-tmp/1000_Genomes_NYGC_30x/1000_Genomes_NYGC_30x_samples_ped_population.txt.bgz", delimiter="\s+", impute=True ) ht_samples = ht_samples.annotate( FatherID = hl.if_else(ht_samples.FatherID == "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: Phased genotypes Step2: ChrX (phased) Step3: Unphased genotypes Step4: Separate biallelic and multiallelic variants, split multiallelic varia...
5,304
<ASSISTANT_TASK:> Python Code: import pandas as pd import re df = pd.read_csv('data_tau_ta.csv') df.head() df.shape import nltk from nltk.corpus import stopwords stop = stopwords.words('english') stop.extend(('.', ',', '"', "'", '?', '!', ':', ';', '(', ')', '[', ']', '{', '}','/','-')) tokens_list = df['tokens'].tolis...
<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: Term Frequency and Inverse Document Frequency Step2: Let us get in how many documents (each title) does the word occur Step3: Let us compute t...
5,305
<ASSISTANT_TASK:> Python Code: import ICO import os import pandas as pd import time data = ICO.Data(os.getcwd()+'/data/') start = time.time() data["all_encounter_data"] print(time.time() - start) data["all_encounter_data"].describe(include='all') data["all_encounter_data"].columns.values data['all_encounter_data'].sh...
<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 Data object is initialized with the path to the directory of .pickle files. On creation it reads in the pickle files, but does not transform...
5,306
<ASSISTANT_TASK:> Python Code: import os from datetime import timedelta import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, ve...
<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: Notice that orig_time is None, because we haven't specified it. In Step3: Since the example data comes from a Neuromag system that sta...
5,307
<ASSISTANT_TASK:> Python Code: # INITIAL DEFINITIONS from pyKRR import KRRsolver # import our KRR solver object import numpy, random import numpy, math, random import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.sparse import load_npz # TYPE is the descriptor type TYPE = "cnt" #show des...
<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 pick a descriptor. Allowed types are Step2: and load the databases with the descriptors (input) and the correct charge densities (output)...
5,308
<ASSISTANT_TASK:> Python Code: ## Solution 1. import numpy as np A = np.array([[0, 0, 1, 0, 0, 1, 0, 0], #A [0, 0, 0, 0, 1, 0, 0, 1], #B [1, 0, 0, 1, 0, 1, 0, 0], #C [0, 0, 1, 0, 1, 0, 1, 0], #D [0, 1, 0, 1, 0, 0, 0, 1], #E [1, 0, 1, 0, 0, 0, 1, 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: Q2. Step2: Q3. Step3: Q4
5,309
<ASSISTANT_TASK:> Python Code: import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import numpy as np import xarray as xr import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import add_metpy_logo, add_timestamp from metpy.units import units 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: We will reduce the dimensionality of the data as it is pulled in to remove an empty time Step3: To properly interpolat...
5,310
<ASSISTANT_TASK:> 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 ShuffleSpl...
<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: Classification with linear discrimant analysis Step2: Look at performance over time
5,311
<ASSISTANT_TASK:> Python Code: %matplotlib inline import sys import y4m import matplotlib.pyplot as plt import numpy as np def decode_y4m_buffer(frame): W, H = frame.headers['W'], frame.headers['H'] Wdiv2, Hdiv2 = W // 2, H // 2 C, buf = frame.headers['C'], frame.buffer A, Adiv2, div2 = W * H, Hdiv2 * 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: The DCT Domain Step2: Back to the Pixel Domain Step3: Subsampling Time Step4: Comparing with spatial domain subsampling
5,312
<ASSISTANT_TASK:> Python Code: from itertools import combinations, chain def simplex_closure(a): Returns the generator that iterating over all subsimplices (of all dimensions) in the closure of the simplex a. The simplex a is also included. return chain.from_iterable([combinations(a, l) for l in ra...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step8: Extending values on vertices to a discrete gradient vector field Step9: Let us test the above function on the simple example Step12: Now let u...
5,313
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'niwa', 'sandbox-1', 'aerosol') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "em...
<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...
5,314
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'gfdl-esm2m', 'aerosol') # 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...
5,315
<ASSISTANT_TASK:> Python Code: # At first ensure connexion is installed # together with the swagger module used to render the OAS3 spec # in the web-ui !pip install connexion[swagger-ui] connexion # A request on a generic PATH on the server returns a # nicely formatted and explicative error. # Remember that we haven...
<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: Now run the spec in a terminal using Step2: Defining endpoints in OAS3 Step3: Solution on the unimplemented method Step4: Exercise
5,316
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline from sksurv.datasets import load_breast_cancer from sksurv.linear_model import CoxPHSurvivalAnalysis, CoxnetSurvivalAnalysis from sksurv.preprocessing import OneHotEncoder from sklearn.model_selectio...
<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 demonstrate the use of penalized Cox models we are going to use the breast cancer data, which contains the expression levels of 76 genes, age...
5,317
<ASSISTANT_TASK:> Python Code: import ROOT %jsroot on f = ROOT.TFile.Open("mc_105986.ZZ.root") #f = ROOT.TFile.Open("mc_147770.Zee.root") #f = ROOT.TFile.Open("http://opendata.atlas.cern/release/samples/MC/mc_147770.Zee.root") canvas = ROOT.TCanvas("Canvas","c",800,600) tree = f.Get("mini") hist = ROOT.TH1F("varia...
<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: In order to activate the interactive visualisation of the histogram that is later created we can use the JSROOT magic Step2: Next we have to op...
5,318
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 import warnings import pandas as pd import numpy as np import os import sys # error msg, add the modules import operator # sorting from math import * import matplotlib.pyplot as plt sys.path.append('../../') import cuda_timeline import read_trace import ...
<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: gpu info Step2: Understand the input Step3: Kernel Info from the single stream Step4: model 3 cuda streams Step5: start kernel from beginnin...
5,319
<ASSISTANT_TASK:> Python Code: # If you want the figures to appear in the notebook, # and you want to interact with them, use # %matplotlib notebook # If you want the figures to appear in the notebook, # and you don't want to interact with them, use # %matplotlib inline # If you want the figures to appear in separate...
<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: Modeling and Simulation in Python Step3: Testing make_system Step4: Testing slope_func Step5: Now we can run the simulation. Step6: Plotting...
5,320
<ASSISTANT_TASK:> Python Code: %run ../linked_list/linked_list.py %load ../linked_list/linked_list.py class MyLinkedList(LinkedList): def delete_node(self, node): # TODO: Implement me pass # %load test_delete_mid.py from nose.tools import assert_equal class TestDeleteNode(object): def test_dele...
<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: Unit Test
5,321
<ASSISTANT_TASK:> Python Code: import numpy as np import GPy %matplotlib inline #%config InlineBackend.figure_format = 'svg' from pylab import * # Let's make some synthetic data x = np.linspace(0.,2*np.pi,100)[:,None] y = -cos(x)+np.random.randn(*x.shape)*0.3+1 _ = plot(x,y,'.') # Make a GP regression model m = GPy.m...
<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: Example 1 HMC Inference for GP Regression Step2: Let us Make a GP Regression model and give some general prior distributions to model paramete...
5,322
<ASSISTANT_TASK:> Python Code: %sql mysql://steinam:steinam@localhost/sommer_2014 %%sql select * from artikel where Art_Bezeichnung like '%Schmerzmittel%' or Art_Bezeichnung like '%schmerzmittel%'; %%sql select k.Kd_firma, sum(rp.RgPos_Menge * rp.RgPos_Preis) as Umsatz from Kunde k left join Rechnung r ...
<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: Frage 1 Step2: Frage 2 Step3: Frage 3 Step4: Frage 4 Step5: Heiko Mader Step6: Aufgabe 3 Step7: Aufgabe 4 Step8: Leichte Änderungen führe...
5,323
<ASSISTANT_TASK:> Python Code: # check which python is in use. import sys print('Notebook is running:', sys.executable) # /opt/conda/bin/python # or uncomment the code below from platform import python_version # 3.7.6 print('The current Python version is', python_version()) import hddm, IPython print('The current HDDM ...
<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 1 Step2: Part 2 Step3: Test the docker image Step4: Test the docker image Step5: Check convergence (visual inspection) Step7: Test the...
5,324
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from collections import Counter %matplotlib inline df = pd.read_csv('pdata.csv') print(df.columns.values) print('\nNumber of hits on the website is %s hit' %len(df['Source IP'])) total_hits = Co...
<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 data sets that we will work on are logs from the firewall, we will use the small file pdata.csv to simplify readings and then we will use th...
5,325
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import pandas as pd from scipy import sparse import scipy.sparse.linalg as spla import matplotlib.pyplot as plt import seaborn as sns sns.set_context('notebook', font_scale=1.5) A = np.random.poisson(0.2, (5,15)) * np.random.randint(0, 10, (5, 15)) 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: Creating a sparse matrix Step2: From coordinates Step3: Convert back to dense matrix Step4: Compressed Sparse Row and Column formats Step5: ...
5,326
<ASSISTANT_TASK:> Python Code: %%time # 引入这个项目需要的库 import numpy as np import pandas as pd import visuals as vs from IPython.display import display # 使得我们可以对DataFrame使用display()函数 # 设置以内联的形式显示matplotlib绘制的图片(在notebook中显示更美观) %matplotlib inline # 载入整个客户数据集 try: data = pd.read_csv("customers.csv") data.drop(['Regi...
<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: 问题 1 Step4: 问题 2 Step5: 问题 3 Step6: 观察 Step7: 练习 Step8: 问题 4 Step9: 问题 5 Step10: 练习:降维 Step11: 观察 Step12: 可视化一个...
5,327
<ASSISTANT_TASK:> Python Code: import numpy as np np.random.seed(1234) n = 1000 p = np.random.rand(n) p.sort() def shift(x, y): y[1:] = x[:-1] y[0] = 0 def cl(p, k): p = p.copy() p.sort() xi = np.zeros(k) xi[0] = 1 xi2 = np.zeros(k) shift(xi, xi2) for pp in p: xi *= (1 - pp) ...
<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: OK, so that's pretty neat, the FFT paper's R code runs in quadratic time, neatly quadrupling in runtime for every doubling of input. The numpy v...
5,328
<ASSISTANT_TASK:> Python Code: import pylab as plt # %matplotlib inline import numpy as np def gen_im(n=1): rn = np.random.uniform(low=0, high=1, size=(20,)) # Make a random plot... fig = plt.figure() ax = fig.add_subplot(111) ax.plot(rn,"r") ax.grid() DPI = fig.get_dpi() fig....
<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: Synthetic image generation function Step2: Batch image generation function Step3: Let's start with 1000 training samples and 100 test samples ...
5,329
<ASSISTANT_TASK:> Python Code: # Authors: Denis A. Engemann <denis.engemann@gmail.com> # Stefan Appelhoff <stefan.appelhoff@mailbox.org> # # License: BSD-3-Clause import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import somato from mne.baseline import rescale ...
<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 parameters Step2: We create average power time courses for each frequency band Step4: Now we can compute the Global Field Power
5,330
<ASSISTANT_TASK:> Python Code: from __future__ import division import tensorflow as tf from os import path import numpy as np import pandas as pd import csv from sklearn.model_selection import StratifiedShuffleSplit from time import time from matplotlib import pyplot as plt import seaborn as sns from mylibs.jupyter_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: Step 0 - hyperparams Step2: Step 1 - collect data (and/or generate them) Step3: Step 2 - Build model Step4: Step 3 training the network Step5...
5,331
<ASSISTANT_TASK:> Python Code: # let's load MNIST data as we did in the exercise on MNIST with FC Nets # %load ../solutions/sol_52.py ## try yourself ## `evaluate` the model on test data <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: Step1: Step 2
5,332
<ASSISTANT_TASK:> Python Code: import pandas as pd # data package import matplotlib.pyplot as plt # graphics import sys # system module, used to get Python version import os # operating system tools (check files) import datetime as dt # date tools, used...
<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=lucky></a> Step2: Question. What do we have here? A list of length 10? Whose elements are dataframes? Evidently this reads in all the ...
5,333
<ASSISTANT_TASK:> Python Code: import os import pandas as pd # Load Data gl = pd.read_csv('..\data\game_logs.csv') # Available also at https://data.world/dataquest/mlb-game-logs # Data Preview gl.head() gl.dtypes.head() # Select only the column with same type gl.select_dtypes(include=['object']).head() #Exact amount o...
<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: Original Article Step2: First Look Step3: Under the hood, pandas groups the columns into block of values of the same type Step4: Subtype Step...
5,334
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import warnings warnings.filterwarnings('ignore') from cogstat import cogstat as cs print(cs.__version__) cs_dir, dummy_filename = os.path.split(cs.__file__) # We use this for the demo data # Load some data data = cs.CogStatData(data=os.path.join(cs_dir, 'sa...
<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: Explore variable in interval, ordinal and nominal variables Step3: Explore relation pairs in interval, ordinal and nominal variabl...
5,335
<ASSISTANT_TASK:> Python Code: import os !ls if not os.path.exists("ery_30-15.sorted.cov.gz"): try: # 'call' is from the subprocess module retcode = os.system("bamtools coverage -in ery_30-15.sorted.bam | gzip > ery_30-15.sorted.cov.gz") if retcode < 0: print "Child was terminat...
<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: If a ery_30-15.sorted.cov does not exist yet, create one using bamtools coverage Step2: Let's have a quick look at the new coverage file Step3:...
5,336
<ASSISTANT_TASK:> Python Code: from sklearn import cross_validation, datasets import numpy as np iris = datasets.load_iris() train_data, test_data, train_labels, test_labels = cross_validation.train_test_split(iris.data, iris.target, ...
<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: Разовое разбиение данных на обучение и тест с помощью train_test_split Step2: Стратегии проведения кросс-валидации Step3: StratifiedKFold Step...
5,337
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt from IPython.display import display, Math, Latex, HTML from google.colab.output._publish import javascript url = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=default" # <SOL> # ############### # Data generation ...
<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 company Like2Call offers hosting services for call centers. In order to dimension the staff of operators optimally, the company has collecte...
5,338
<ASSISTANT_TASK:> Python Code: import tensorflow as tf x = [[[[1, 2, 3], [2, 3, 4], [0, 0, 0]], [[1, 2, 3], [2, 0, 4], [3, 4, 5]], [[1, 2, 3], [0, 0, 0], [0, 0, 0]], [[1, 2, 3], [1, 2, 3], [0, 0, 0]]], [[[1, 2, 3], [0, 1, 0], [0, 0, 0]], [[1, 2, 3], [2, 3, 4], [0, 0, 0]], [[1, 2, 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:
5,339
<ASSISTANT_TASK:> Python Code: # For embedding audio player import IPython # Plots import matplotlib.pyplot as plt from pylab import plot, show, figure, imshow plt.rcParams['figure.figsize'] = (15, 6) import numpy import essentia.standard as es audiofile = '../../../test/audio/recorded/flamenco.mp3' # Load audio file. ...
<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 zero pitch value correspond to unvoiced audio segments with a very low pitch confidence according to the algorithm's estimation. You can for...
5,340
<ASSISTANT_TASK:> Python Code: import tensorflow as tf print(tf.version.VERSION) device_name = tf.test.gpu_device_name() if device_name != '/device:GPU:0': raise SystemError('GPU device not found') print('Found GPU at: {}'.format(device_name)) !cat run_dataflow.sh !./run_dataflow.sh > /dev/null 2>&1 !ls -l flower_tf...
<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 Beam pipeline locally Step2: Display preprocessing data Step3: Train the model Step4: Predictions
5,341
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline def getOrbitPoints(EI, H, F, nVertex): if (abs(F) <= H)|(abs(F) < 1.E-8): theta0 = np.pi else: theta0 = np.arccos(H/F) theta = np.li...
<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 Effect of the variation of the static parameters Step2: 1.1 Constant energy $\mathcal{H}$, varying force magnitude $F$ Step3: 1.2 Constant m...
5,342
<ASSISTANT_TASK:> Python Code: import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd import numpy as np import time C = 1 kernel = 'linear' # TODO: Change to 200000 once you get to Question#2 iterations = 5000 # You can set this to false if you want to draw the full square matrix: FAST_DRAW = 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: Feel free to adjust and experiment with these parameters after you have completed the lab Step2: Convenience Functions Step3: The Assignment S...
5,343
<ASSISTANT_TASK:> 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 writin...
<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: Keras Step2: tf.keras can run any Keras-compatible code, but keep in mind Step3: Configure the layers Step4: Train and evaluate Step5: tf.ke...
5,344
<ASSISTANT_TASK:> Python Code: import pymc3 as pm import numpy as np from pymc3.step_methods import smc import theano.tensor as tt from matplotlib import pyplot as plt from tempfile import mkdtemp import shutil %matplotlib inline test_folder = mkdtemp(prefix='ATMIP_TEST') n_chains = 500 n_steps = 100 tune_interval = 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: The number of Markov chains and the number of steps each Markov chain is sampling has to be defined, as well as the tune_interval and the number...
5,345
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import pandas as pd df = pd.read_csv("train.csv") df.head() # 65歳の人のデータを抜き出す df[df.Age == 65][['Name', 'Age']] # データ件数 len(df) # 先頭2件を確認 df.head(2) # 後ろ5件(デフォルト5件)を確認 df.tail() # 先頭3件の名前、年齢、性別のみ出力 df[['Name', 'Age', 'Sex']].head(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: 以下のようなデータがある Step2: データを見てみよう Step3: 1-2. 集計 Step4: 1-3. データの前処理 Step5: 欠損値の補間 Step6: カラムの追加 Step7: 1-4. データの可視化
5,346
<ASSISTANT_TASK:> Python Code: import logging import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from collections import OrderedDict from IPython.display import display, Markdown from sodapy import Socrata logging.disable(logging.WARNING) # utility function to print python output as markdown snip...
<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: Simple enough! We can see that each row in this dataset is a service request record containing Step2: Wait, but we can do even better! Based o...
5,347
<ASSISTANT_TASK:> Python Code: //***Do like your comments in stack.h so copied here for future review and study:*** // In C++ a class is just a fancy struct // Both struct and class have two internal namespaces: // private: only accessible by the struct/class itself // public: accessible by other code that is usi...
<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: iii. Explain what private and public do Step2: iv. Explain what size_t is used for Step3: v. Explain why this code avoids the use of C pointer...
5,348
<ASSISTANT_TASK:> Python Code: x = input() if x.find("rr")!= -1: y = x[1:] else: y = x[:-1] print(y) x = input() y = x.split() w = "" for z in y: w = w + z[1] print(w) x = input() x = x + x x = x.replace("o","i") x = x[:5] print(x) # all at once with open(filename, 'r') as handle: contents = handle.r...
<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. erry Step2: A. iic Step3: A. tony Step4: Writing a To File Step5: Watch Me Code 1 Step6: A. 1 Step7: A. 1 Step8: End-To-End Example...
5,349
<ASSISTANT_TASK:> Python Code: %matplotlib inline %config InlineBackend.figure_formats = {'png', 'retina'} import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import MySQLdb from sklearn.tree import export_graphviz from sklearn.cross_validation import tr...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step7: 1. Connect DB and Make QUERY Step8: 2. Make Pandas DataFrame Each Position Player Step9: 3. Set Position Category and Concat Each Datafream St...
5,350
<ASSISTANT_TASK:> Python Code: data = pd.read_csv('data/bike_oneweekfrom20140505.csv', index_col=0, parse_dates=True) data.info() data.columns new_column_names = ['trip_time', 'pickup_datetime', 'dropoff_datetime', 'start_station_id', 'start_station_name', 'pickup_latitude', 'pickup_longitude', 'end_stat...
<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: Rename the columns. They're now streamlined with the taxi input. Step2: Parse the dates. Step3: Have a look at every station. How many pickups...
5,351
<ASSISTANT_TASK:> Python Code: # Lets see how many lines are in the PDF # We can use the '!' special character to run Linux commands inside of our notebook !wc -l test.txt # Now lets see how many words !wc -w test.txt import nltk from nltk import tokenize # Lets open the file so we can access the ascii contents # fd st...
<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 want to "tokenize" the text and discard "stopwords" like 'a', 'the', 'in'. These words aren't relevant for our analysis. Step2: We want to t...
5,352
<ASSISTANT_TASK:> Python Code: import numpy as np from matplotlib import pyplot # Iterative for 1-D linear convection def lin_convection_1d(nx=41, nt=100, dt=0.01, c=1, u_init = [2,2,2,2], init_offset = 5) : ''' nx = 41 # Number of horizontal location points (x axis on graph) nt = 100 # Number of time step ...
<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: Discussion
5,353
<ASSISTANT_TASK:> Python Code: def rectanglearea(r ) : if r < 0 : return - 1  a = r * r return a  if __name__== "__main __": r = 5  <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:
5,354
<ASSISTANT_TASK:> Python Code: import cashflows as cf cflo=cf.cashflow(const_value=1000, nper=10, spec=[(t,-90) for t in range(5,10)]) cf.cfloplot(cflo) tax_rate = cf.nominal_rate(const_value=[30] * 10) x=cf.after_tax_cashflow(cflo, # flujo de efectivo tax_rate = tax_rate) # impuesto de...
<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: Impuestos corporativos Step2: Ejemplo.-- Considere un flujo de caja de \$ 100, y una duración de 10 periodos. Calcule el impuesto de renta si l...
5,355
<ASSISTANT_TASK:> Python Code: import pandas as pd import contiamo import seaborn as sns import numpy as np transactions = %contiamo query query:sql:48590597:411:g71GXzJjsx4Uvad11ouKjoYbQUNNPy-qRMKkBNZfyx4 customers = %contiamo query query:sql:48590597:441:MG5W2dMjXzYgsHsgdQYzmhv44dxEQX2Lodu5Uh2Hx_s applications = %co...
<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: Query data into Contiamo Step2: Select data from the customers table Step3: Select data from the transactions table Step4: Merge tables and g...
5,356
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import math import cmath from scipy.optimize import root import matplotlib.pyplot as plt %matplotlib inline a = ("Table1.txt") a class InterfazPolimero: def __init__ (self,a): self.a=a def Lire(self): self.tab = pd.read_csv(...
<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: Polymère Step2: Calcul de la concentration finale Step3: Table des valeurs Step4: Calcul de c2 Step5: Graphique Step6: Graphique Step7: ...
5,357
<ASSISTANT_TASK:> Python Code: %pylab inline %matplotlib inline import numpy as np import scipy.io dataset = scipy.io.loadmat('../../../data/ocr/ocr_taskar.mat') # patterns for training p_tr = dataset['patterns_train'] # patterns for testing p_ts = dataset['patterns_test'] # labels for training l_tr = dataset['labels_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: Step2: Few examples of the handwritten words are shown below. Note that the first capitalized letter has been removed. Step3: Define Factor Types and ...
5,358
<ASSISTANT_TASK:> Python Code: from __future__ import print_function import os import re from gensim.corpora import TextCorpus, MmCorpus from gensim import utils, models from gensim.parsing.preprocessing import STOPWORDS from gensim.utils import deaccent class TextDirectoryCorpus(TextCorpus): Read documents recurs...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step8: Parsing the Dataset Step9: Loading the Dataset Step10: Training the Models Step11: Evaluation Using Coherence
5,359
<ASSISTANT_TASK:> Python Code: import numpy as np import math from numba import jit N = 10000 x = np.random.randn(N, 2); y = np.random.randn(N, 2); charges = np.ones(N) res = np.zeros(N) @jit def compute_nbody_direct(N, x, y, charges, res): for i in xrange(N): res[i] = 0.0 for j in xrange(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: Question Step2: Smoothed particle hydrodynamics Step3: Applications
5,360
<ASSISTANT_TASK:> Python Code: # for inline plotting in the notebook %matplotlib inline import numpy as np import matplotlib.pyplot as plt def plot_log(): figure, axis = plt.subplots(2, 1) x = np.linspace(1, 2, 10) axis.plot(x, np.log(x)) plt.show() plot_log() # Call the function, generate plot # Unc...
<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: Unfortunately, when you go to execute the code block, Python throws an error. Some friend! How can we fix the code so that it runs correctly? St...
5,361
<ASSISTANT_TASK:> Python Code: # standard library import os import time import shutil # Load Python SDK from azure import * from azure.servicemanagement import * from azure.storage import * # Subscription details subscription_id = '1a61650c-ada5-4173-a8da-2a4ffcfab747' certificate_path = 'mycert.pem' # Initialize conn...
<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: Setting up a Cloud Service Step2: Create Storage Account Step3: Working with Containers Step4: Working with Blobs Step5: Cleaning Up Step6: ...
5,362
<ASSISTANT_TASK:> Python Code: # As usual, a bit of setup import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solver impo...
<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: Fully-Connected Neural Nets Step4: Affine layer Step5: Affine layer Step6: ReLU layer Step7: ReLU layer Step8: "Sandwich" layers Step9: Lo...
5,363
<ASSISTANT_TASK:> Python Code: import time from collections import namedtuple import numpy as np import tensorflow as tf with open('anna.txt', 'r') as f: text=f.read() vocab = set(text) vocab_to_int = {c: i for i, c in enumerate(vocab)} int_to_vocab = dict(enumerate(vocab)) chars = np.array([vocab_to_int[c] for c ...
<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: First we'll load the text file and convert it into integers for our network to use. Step3: Now I need to split up the data into batches, and in...
5,364
<ASSISTANT_TASK:> Python Code: import sys # system module import pandas as pd # data package import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module import numpy as np # foundation for Pa...
<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: Packages Imported Step2: Number of Home Runs by Year Step3: Number of Stolen Bases by Year Step4: Number of Doubles by Year Step5: Number of...
5,365
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.display import (display, SVG) from IPython.html.widgets import interact, interactive, fixed from IPython.html import widgets s = <svg width="100" height="100"> <circle cx="50" cy="50" r="20" fill="aquam...
<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 with SVG display Step5: Write a function named draw_circle that draws a circle using SVG. Your function should take the parameters of ...
5,366
<ASSISTANT_TASK:> Python Code: from __future__ import division, print_function import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline data1 = pd.read_csv('pca2.csv', sep=',') data1.ix[0:2, 'X1':'X2'] data1.ix[0:2, :] data1.shape m = np.mean(data1, 0) data1_centered = data1 - m data1_...
<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: Exercise 1 Step2: B Step3: By deleting 2 of the 500 datapoints, the projection on the PCs change about 10 degrees. Hence the PCs itself change...
5,367
<ASSISTANT_TASK:> Python Code: %matplotlib inline %config InlineBackend.figure_format = "retina" from matplotlib import rcParams rcParams["savefig.dpi"] = 100 rcParams["figure.dpi"] = 100 rcParams["font.size"] = 20 %matplotlib inline import bioscrape as bs from bioscrape.types import Model from bioscrape.inference 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: Using Gaussian prior for k1 Step2: Using mixed priors and estimate both k1 and d1 Step3: Check mcmc_results.csv for the results of the MCMC pr...
5,368
<ASSISTANT_TASK:> Python Code: %pylab inline # Import libraries from __future__ import absolute_import, division, print_function # Ignore warnings import warnings #warnings.filterwarnings('ignore') import sys sys.path.append('tools/') import numpy as np import pandas as pd import scipy.stats as st # Graphing Libraries ...
<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: Data Sampling Step3: Smokers and Nonsmokers Step4: The histogram below displays the distribution of birth weights of the babies of the non-smo...
5,369
<ASSISTANT_TASK:> Python Code: !pip install -I "phoebe>=2.0,<2.1" %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() b['q'] = 0.8 b['ecc'] = 0.1 b['irrad_method'] = 'none' b.add_dataset('orb', times=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: This first line is only necessary for ipython noteboooks - it allows the plots to be shown on this page instead of in interactive mode Step2: A...
5,370
<ASSISTANT_TASK:> Python Code: %matplotlib inline from matplotlib import pyplot as plt from sqlalchemy import create_engine from sqlalchemy_utils import database_exists, create_database import psycopg2 import pandas as pd # Requires v 0.18.0 import numpy as np import seaborn as sns sns.set_style("whitegrid") dbname = '...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step3: Descriptive statistics Step6: Plot the distribution of money involved per transaction. There are ~900 cases where no money was exchanged, but a...
5,371
<ASSISTANT_TASK:> Python Code: %config InlineBackend.figure_format = 'retina' %matplotlib inline import numpy as np import scipy as sp import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') # Define sawtooth shape in some number of samples x1 = np.array([0,.05,.2,1,.9,.8,.7,.6,.5,.4,.3,.2,.1,.05,...
<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. Simulate a 20Hz sawtooth wave Step2: 2. Filter in 13-30Hz band Step3: 3. Calculate instantaneous measures Step4: 4. Visualize Step5: 5. ...
5,372
<ASSISTANT_TASK:> Python Code: def parentheses_util(no_left, no_right, pair_string, result): # TODO: implement parentheses pairing here pass def pair_parentheses(n): result_set = set() if n == 0: return result_set parentheses_util(n, n, '', result_set) return result_set # %load test_n_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: Unit Test
5,373
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler np_array = load_data() scaler = MinMaxScaler() X_one_column = np_array.reshape([-1, 1]) result_one_column = scaler.fit_transform(X_one_column) transformed = result_one_column.reshape(np_array.shape) <END...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
5,374
<ASSISTANT_TASK:> Python Code: # Set up some imports that we will need from pymatgen import Lattice, Structure from pymatgen.analysis.diffraction.xrd import XRDCalculator from IPython.display import Image, display %matplotlib inline # Create CsCl structure a = 4.209 #Angstrom latt = Lattice.cubic(a) structure = Struct...
<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: $\alpha$-CsCl ($Pm\overline{3}m$) Step2: Compare it with the experimental XRD pattern below. Step3: $\beta$-CsCl ($Fm\overline{3}m$) Step4: C...
5,375
<ASSISTANT_TASK:> Python Code: Image(url="https://kanbanize.com/blog/wp-content/uploads/2014/07/Standard_deviation_diagram.png", width=500) def qq_plot(x): import scipy.stats (osm, osr),(slope, intercept, r) = scipy.stats.probplot(x, dist='norm', plot=None) plt.plot(osm, osr, '.', osm, slope*osm + interce...
<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: How to test it Step2: 1.2 Equal variance (if two or more groups) Step3: How to test it Step4: 1.3 i.i.d. (independent and identically distrib...
5,376
<ASSISTANT_TASK:> Python Code: import copy from IPython.display import Image import matplotlib.pyplot as plt import numpy as np import pandas as pd import random from sklearn.metrics import r2_score, mean_squared_error %matplotlib inline plt.rcParams["figure.figsize"] = (8,6) # `unemploy.csv` is included in the repo - ...
<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: &lt; optional web data acquisition &gt; Step2: Simple models Step3: Note that the shift() method effectively slides the index up (relative to ...
5,377
<ASSISTANT_TASK:> Python Code: % matplotlib inline import pandas as pd from dateutil.relativedelta import relativedelta import statsmodels.formula.api as sm import requests #import seaborn as sns import numpy as np import matplotlib.pyplot as plt df_reg = pd.read_csv("../../data/retention/newcomer_sample_features.csv"...
<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 Preprocessing Step2: Regression over Time
5,378
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() cancer.keys() print(cancer['DESCR']) cancer['feature_names'] df_feat = pd.DataFrame(cancer['dat...
<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: Get the Data Step2: The data set is presented in a dictionary form Step3: We can grab information and arrays out of this dictionary to set up ...
5,379
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np from geoscilabs.gpr.GPR_zero_offset import WidgetWaveRegime from geoscilabs.gpr.Attenuation import AttenuationWidgetTBL fc = 250*1e6 d = 6 v = 3*1e8 / np.sqrt(4) np.sqrt(v*d / (2*fc)) WidgetWaveRegime() AttenuationWidgetTBL() <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: Step1: GPR Zero Offset App (Wave Regime) Step2: Attenuation App
5,380
<ASSISTANT_TASK:> Python Code: ! pip3 install -U google-cloud-aiplatform --user ! pip3 install google-cloud-storage import os if not os.getenv("AUTORUN"): # Automatically restart kernel after installs import IPython app = IPython.Application.instance() app.kernel.do_shutdown(True) PROJECT_ID = "[your...
<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: Install the Google cloud-storage library as well. Step2: Restart the Kernel Step3: Before you begin Step4: Region Step5: Timestamp Step6: A...
5,381
<ASSISTANT_TASK:> Python Code: ## This cell imports various packages which are needed for the code to run import pandas as pd # pandas is used to organize the data import matplotlib.pyplot as plt # Intro/basic graphics import seaborn as seab # Better graphics import pandas.io.dat...
<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 Sources Step2: Note that the four major sub-components of spending (Defense, Medicare, Nondefense Discretionary, and Social Security) are ...
5,382
<ASSISTANT_TASK:> Python Code: !pip install -q -U pip !pip install -q tensorflow==2.2.0 !pip install -q -U google-auth google-api-python-client google-api-core import os import numpy as np import tensorflow as tf print(f"Tensorflow version: {tf.__version__}") PROJECT_ID = "yourProject" # Change to your project. BUCK...
<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 libraries Step2: Configure GCP environment settings Step3: Authenticate your GCP account Step4: Create the embedding lookup model Step...
5,383
<ASSISTANT_TASK:> Python Code: import subprocess import hail as hl hl.init() list_tissues = subprocess.run(["gsutil", "-u", "broad-ctsa", "ls", "gs://hail-datasets-tmp/GTEx/GTEx_Analysis_v8_QTLs/GTEx_Analysis_v8_eQTL_all_associations"], stdout=subprocess...
<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: First we can grab a list of the GTEx tissue names Step2: Take a peek at the tissue names we get to make sure they're what we expect Step3: We ...
5,384
<ASSISTANT_TASK:> Python Code: !pyNTCIREVAL !cat ../data/eval/q1.rel !cat ../data/eval/method1.q1.res !pyNTCIREVAL label -r ../data/eval/q1.rel < ../data/eval/method1.q1.res !pyNTCIREVAL label -r ../data/eval/q1.rel < ../data/eval/method1.q1.res > ../data/eval/method1.q1.rel !cat ../data/eval/method1.q1.rel !pyNT...
<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: なお,notebook上で $!$ の後の文字列はシェル(ターミナル)に対するコマンドと解釈され,シェルの出力がnotebookの画面に出力されます. Step2: このファイルの一行の意味は, Step3: このように,検索結果ファイルはランキング結果を単純に文書IDで表します.た...
5,385
<ASSISTANT_TASK:> Python Code: import jax import jax.numpy as jnp import matplotlib.pyplot as plt import numpy as np from jax.scipy.stats import multivariate_normal jax.config.update("jax_platform_name", "cpu") import blackjax import blackjax.smc.resampling as resampling def V(x): return 5 * jnp.square(jnp.sum(x**...
<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: Sampling from a bimodal potential Step2: Sample with HMC Step3: Sample with NUTS Step5: Tempered SMC with HMC kernel Step6: Sampling from th...
5,386
<ASSISTANT_TASK:> Python Code: import inspect from math import sqrt, pi import matplotlib.pyplot as plt import numpy as np import pandas as pd from ipywidgets import interact from ipywidgets.widgets import FloatSlider, IntSlider from scipy.integrate import quad plt.rcParams.update({'font.size': 16}) # Debye-Huckel def...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step4: Pair potentials Step5: Interaction parameter Step6: Interactive EOS plot Step8: With Data
5,387
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import numpy as np import pandas as pd data = pd.read_csv('november.csv') ind = data['center_diff_valid'] plt.plot(data['time'][ind] / (60 * 60 * 24), data['temp'][ind], '.') plt.ylabel('Temperature [F]') plt.xlabel('Days') plt.show() Th = data['temp'][ind...
<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: Problem 1.3 Step2: Problem 1.4 Step3: The 95% confidence interval for $\frac{\alpha}{c_p}$ is 0.0289 $\pm$ 0.001 inverse hours
5,388
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-2', 'landice') # 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...
5,389
<ASSISTANT_TASK:> Python Code: #importer les libraires #pour afficher import matplotlib.pyplot as plt #pour le calcul import numpy as np #pour le réseau import networkx as nx %matplotlib inline #instancier le graph g = nx.Graph() #ajouter un noeud #g.add_node("paul") #ajouter une liste de noeud g.add_nodes_from(["paul"...
<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: La position des sommets et des arêtes n'a pas d'importance d'un point de vue mathématiques. Step2: Matrices Step3: Pour les curieux voir l'ex...
5,390
<ASSISTANT_TASK:> Python Code: # Ensures compatibility between Python 2 and 3. from __future__ import print_function, division from __builtin__ import range print('Hello Python world!') ... print(message) # Example of two strings. my_string = "This is a double-quoted string." your_string = 'This is a single-quoted 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: Hello World Step2: Try to get the following code to print the same message as the one above. Step3: Strings Step4: We now want to manipulate ...
5,391
<ASSISTANT_TASK:> Python Code: Image('PyAudio_RT_flow@300dpi.png',width='90%') pah.available_devices() # define a pass through, y = x, callback def callback(in_data, frame_count, time_info, status): DSP_IO.DSP_callback_tic() # convert byte data to ndarray in_data_nda = np.fromstring(in_data, dtype=np.int16...
<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: Real-Time Loop Through Step2: Real-Time Filtering Step3: Create some global variables for the filter coefficients and the filter state array (...
5,392
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer import numpy as np from functools import reduce # Needed for the scikit-learn wrapper function from sklearn.utils import resample from sklearn.ensemble import RandomForestClassifier from mat...
<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: Step 1 Step2: Check out the data Step3: Step 2 Step4: STEP 3 Step5: Perform Manual CHECKS on the irf_utils Step 4 Step6: Plot Ranked Featur...
5,393
<ASSISTANT_TASK:> Python Code: from symbulate import * %matplotlib inline P = BoxModel([0, 1], size=5) X = RV(P, sum) outcome = (0, 1, 0, 1, 1) X(outcome) P = Normal(mean=0, sd=1) X = RV(P) X(-0.5) P = BoxModel([0, 1], size=5) X = RV(P, sum) values = X.sim(10000) values values.tabulate(normalize=True) values.count_...
<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='RV'></a> Step2: A random variable can be called as a function to return its value for a particular outcome in the probability space. Ste...
5,394
<ASSISTANT_TASK:> Python Code: %pylab inline %matplotlib inline # import all Shogun classes from modshogun import * from matplotlib.patches import Ellipse # a tool for visualisation def get_gaussian_ellipse_artist(mean, cov, nstd=1.96, color="red", linewidth=3): Returns an ellipse artist for nstd times the sta...
<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: Gaussian Mixture Models and Expectation Maximisation in Shogun Step2: Set up the model in Shogun Step3: Sampling from mixture models Step4: E...
5,395
<ASSISTANT_TASK:> Python Code: from bokeh.io import output_file output_file('/tmp/bokeh_notebook.html') from pandas_datareader import wb indicators_df = wb.get_indicators() indicators_df['sourceOrganization'] = indicators_df['sourceOrganization'].str.decode("utf-8") indicators_df.head() from bokeh.io import show, vf...
<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: Sample Application Step2: Simple DataTable Step4: Add Filtering Step5: Links
5,396
<ASSISTANT_TASK:> Python Code: %%HTML <div style="background-color:#d9edf7;color:#31708;border-color:#bce8f1;padding: 15px;margin-bottom: 20px;border: 1px; border-radius:4px;"> <strong>psittacism: </strong> <p>automatic speech without thought of the meaning of the words spoken</p> <p>New Latin psittacism...
<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: So in conclusion… Step4: Python does not have interfaces. If it did, it would look something like this. Interfaces can be imitated with a class...
5,397
<ASSISTANT_TASK:> Python Code: def add(x, y): Add two numbers Parameters ---------- x : float First input y : float Second input Returns ------- x + y : float return x + y add(1, 2) print(add(3, 4)) print(add(10.61, 5.99)) help(add) im...
<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: Functions Step3: We see that the line add(1, 2) is outside the function and so is executed. We can also call the function repeatedly Step4: Th...
5,398
<ASSISTANT_TASK:> Python Code: import datetime dt = datetime.datetime.now() dt type(dt) dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond, dt.tzinfo dt.weekday() # {0:월, 1:화, 2:수, 3:목, 4:금, 5:토, 6:일} dt1 = datetime.datetime.strptime("2015-12-31 11:32", "%Y-%m-%d %H:%M") dt1 dt1.strftime("%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: datetime.datetime 클래스 Step2: Instance Attributes 속성 Step3: 문자열 변환 Step4: format 기호 Step5: datetime, date, time 변환 Step6: timedelta와 날짜시간 연산...
5,399
<ASSISTANT_TASK:> 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 writin...
<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: Distributed training with Keras Step2: Download the dataset Step3: Define the distribution strategy Step4: Set up the input pipeline Step5: ...