Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
12,300
<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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
<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: Environment Preparation Step2: Unsupervised Anomaly Detection using Chronos Anomaly Detector Step 0 Step3: Step 1 Step4: Step 2 Step5: Step ...
12,301
<ASSISTANT_TASK:> Python Code: # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_assign' # import functions from the modsim.py module from modsim import * radian = ...
<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: Rolling paper Step2: And creating a Params object with the system parameters Step4: The following function estimates the parameter k, which is...
12,302
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np import geopandas as gpd import os from os.path import join import pandas as pd import sys sns.set(style='white') cwd = os.getcwd() data_path = join(cwd, '..', 'Data storage') figure_path = join(cwd...
<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 NERC regions shapefile Step2: Read states shapefile Step3: Transform projection to Albers equal area Step4: Maps of 2001 and 2017 annual...
12,303
<ASSISTANT_TASK:> Python Code: # Load image import cv2 import numpy as np from matplotlib import pyplot as plt # Load image as grayscale image = cv2.imread('images/plane_256x256.jpg', cv2.IMREAD_GRAYSCALE) # Blur image image_blurry = cv2.blur(image, (5,5)) # Show image plt.imshow(image_blurry, cmap='gray'), plt.xtic...
<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 Image As Greyscale Step2: Blur Image Step3: View Image
12,304
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import pymc3 as pm import seaborn as sns import matplotlib.pyplot as plt from collections import defaultdict data = np.random.randn(100) with pm.Model() as model: mu = pm.Normal('mu', mu=0, sd=1, testval=0) sd = pm.HalfNormal('sd', sd=1) ...
<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: Lets generate a very simple model Step2: This function will randomly draw 500 samples of parameters from the trace. Then, for each sample, it w...
12,305
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import matplotlib.pyplot as plt from IPython.display import Image Image("http://journalofdigitalhumanities.org/wp-content/uploads/2013/02/blei_lda_illustration.png") import textmining_blackboxes as tm #see if package imported correctly tm.icantbeli...
<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: Reading at scale Step2: IMPORTANT Step3: Let's keep using the remarkable narratives available from Documenting the American South (http Step4:...
12,306
<ASSISTANT_TASK:> Python Code: %matplotlib inline from datetime import datetime import numpy as np import datacube from dc_water_classifier import wofs_classify from dc_utilities import perform_timeseries_analysis import dc_au_colormaps from dc_notebook_utilities import * dc = datacube.Datacube(app='dc-water-analysis'...
<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 must connect to our data cube. We can then query the contents of the data cube we have connected to, including both the metadata and t...
12,307
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import numpy as np import scipy.stats as ss import vega_datasets x = np.array([1, 1, 1, 1, 10, 100, 1000]) y = np.array([1000, 100, 10, 1, 1, 1, 1 ]) ratio = x/y print(ratio) X = np.arange(len(ratio)) #...
<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: Ratio and logarithm Step2: Q Step3: Q Step4: Log-binning Step5: If you simply call hist() method with a dataframe object, it identifies all ...
12,308
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'messy-consortium', 'sandbox-1', 'ocnbgchem') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contribut...
<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...
12,309
<ASSISTANT_TASK:> Python Code: %sql -d standard SELECT * FROM `nyc-tlc.yellow.trips` LIMIT 5 %bigquery schema --table nyc-tlc:yellow.trips %%bq query -n pickup_time WITH subquery AS ( SELECT EXTRACT(HOUR FROM pickup_datetime) AS hour FROM `nyc-tlc.yellow.trips`) SELECT Hour, COUNT(Hour) AS 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: Let's look at the table schema Step2: 1. What is the most common pick-up time? Step3: Let's name this query result pickup_time and reference i...
12,310
<ASSISTANT_TASK:> Python Code: x = [1,2,3,4,5,6,7,8] for item in x: print item s = ['a','c','b','d','e','g','h',8] for item in s: print item for item in range(1,20,2): print item s=0 for i in range(1,100): s+=i*i print s s=0; i=1 while i<100: s+=i*i i+=1 print s m = 20 n = 79 while n != 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: Range function in python is a daily-use function in the for loop Step2: This is a simple for loop that sum up all squared integer from 1 to 100...
12,311
<ASSISTANT_TASK:> Python Code: a = 10.1 type(a) print(dir(a)) # Show all of the methods of a a.is_integer() # Create a class by using class keyword followed by name. class MyClass: # The 'self' variable ALWAYS needs to be the first variable given to any class method. def __init__(self, message): # Her...
<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 can I see what methods an object of type float has? Step2: <font color='midnightblue'> Aside - What do all those underscores mean? Step3: ...
12,312
<ASSISTANT_TASK:> Python Code: #!pip install --user miepython import numpy as np import matplotlib.pyplot as plt try: import miepython except ModuleNotFoundError: print('miepython not installed. To install, uncomment and run the cell above.') print('Once installation is successful, rerun this cell again.') ...
<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: Wiscombe tests Step2: Spheres with a smaller refractive index than their environment Step3: Non-absorbing spheres Step4: Water droplets Step5...
12,313
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib matplotlib.rcParams['figure.figsize'] = (10.0, 8.0) import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline from scipy.interpolate import UnivariateSpline import json import pandas as pd from functo...
<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: And some more specialized dependencies Step2: Helper routines Step3: Configuration for this figure. Step4: Open a chest located on a remote g...
12,314
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import cvxopt as opt from cvxopt import blas, solvers import pandas as pd np.random.seed(123) # Turn off progress printing solvers.options['show_progress'] = False ## NUMBER OF ASSETS n_assets = 4 ## NUMBER OF OBSERVATIONS n_obs = 1000 ...
<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: Assume that we have 4 assets, each with a return series of length 1000. We can use numpy.random.randn to sample returns from a normal distributi...
12,315
<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: TensorBoard Scalar Step2: 단순 회귀에 대한 데이터 설정 Step3: 모델 학습 및 손실 로깅하기 Step4: TensorBoard를 사용하여 손실 검사하기 Step5: <!-- <img class="tfo-display-only-...
12,316
<ASSISTANT_TASK:> Python Code: # Authors: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Nicolas P. Rougier (graph code borrowed from his matplotlib gallery) # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from...
<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 our data Step2: Compute inverse solutions and their connectivity Step3: Make a connectivity plot Step4: Make two connectivity plots in t...
12,317
<ASSISTANT_TASK:> Python Code: from google.colab import auth auth.authenticate_user() project_id = '[your project id]' import pandas as pd import datetime today = datetime.datetime.utcnow().strftime("%Y%m%d") df = pd.io.gbq.read_gbq(''' SELECT count(*) as total FROM `web_instr_container.stdout_{}` '''.format(tod...
<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: Log Overview Step2: Client Latency Step3: Scatter Plot Step4: Responses
12,318
<ASSISTANT_TASK:> Python Code: import pandas from time import time import cobra.test from cobra.flux_analysis import ( single_gene_deletion, single_reaction_deletion, double_gene_deletion, double_reaction_deletion) cobra_model = cobra.test.create_test_model("textbook") ecoli_model = cobra.test.create_test_model...
<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: Knocking out single genes and reactions Step2: For evaluating genetic manipulation strategies, it is more interesting to examine what happens i...
12,319
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy.interpolate import interp1d # YOUR CODE HERE with np.load('trajectory.npz') as data: x = data['x'] t=data['t'] y=data['y'] plt.plot(t,x,marker='o') assert isinstance(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: 2D trajectory interpolation Step2: Use these arrays to create interpolated functions $x(t)$ and $y(t)$. Then use those functions to create the ...
12,320
<ASSISTANT_TASK:> Python Code: import os import sys import pickle import numpy as np import scipy import matplotlib.pyplot as plt import ChiantiPy.core as ch import sunpy.instr.aia as aia %matplotlib inline response = aia.Response(path_to_genx_dir='../ssw_aia_response_data/') response.calculate_wavelength_response() 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: The goal of this notebook is to test the wavelength and temperature response function calculations that are currently being developed in SunPy. ...
12,321
<ASSISTANT_TASK:> Python Code: import csv from pprint import pprint import math stat = {'Congruent': { 'data': [] }, 'Incongruent': { 'data': [] }, 'Difference': { 'data': [] }} with open('./stroopdata.csv', 'r') as st_data: reader = csv.DictReader(st_data) for row in reader: cong = float(row['Congr...
<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: Question 3 Step3: Question 4 Step4: Question 5
12,322
<ASSISTANT_TASK:> Python Code: from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter import numpy as np import matplotlib.pyplot as plt from IPython import display %matplotlib inline %config InlineBackend.figure_format = 'retina' 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: Adapted from http Step2: Image from https Step3: Label Encoding Step4: Multiclass Classification Step5: Plotting Step6: Model (Logistic Reg...
12,323
<ASSISTANT_TASK:> Python Code: hidden_weights = 256 w = tf.Variable(tf.random_normal([n_input, hidden_weights])) b = tf.Variable(tf.random_normal([hidden_weights])) w2 = tf.Variable(tf.random_normal([hidden_weights, hidden_weights])) w3 = tf.Variable(tf.random_normal([hidden_weights, n_classes])) input_layer = tf.add(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: Perceptron (No cheating, mostly) Step2: Perceptron (No cheating, for real)
12,324
<ASSISTANT_TASK:> Python Code: DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' # Use Floyd's cifar-10 dataset if ...
<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: Image Classification Step2: Explore the Data Step5: Implement Preprocess Functions Step8: One-hot encode Step10: Randomize Data Step12: Che...
12,325
<ASSISTANT_TASK:> Python Code: import numpy as np def bsm(S0,r,sigma,T,K,R = 100000 , seed=500): np.random.seed(seed) z = np.random.standard_normal(R) ST = S0 * np.exp(( r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * z) hT = np.maximum(ST - K, 0) C0 = np.exp(-r * T) * np.sum(hT) / R return C0...
<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 see how much time is necessary for 70,000,000 iterations intead of 100,000 iterations. Step2: Let's see how we can speed up the computati...
12,326
<ASSISTANT_TASK:> Python Code: # Import necessary modules import geopandas as gpd # Set filepath fp = "data/limitebairro.json" # Read file using gpd.read_file() data = gpd.read_file(fp, driver='GeoJSON') type(data) data.head(5) data.plot() # Create a output path for the data outfp = "data/limitebairro.shp" # Selec...
<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: Agora que o arquivo json foi lido na variável data, vamos ver o seu formato Step2: Podemos ver que o tipo da variável é um GeoDataFrame. O obje...
12,327
<ASSISTANT_TASK:> Python Code: %matplotlib inline from __future__ import print_function import datetime from itertools import (islice, chain) import re import time from collections import (Counter, OrderedDict) # writing for eventual Python 2/3 compatability try: from urllib.parse import urlencode except ImportErr...
<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: Working with results from a specific query Step5: Now to retrieve and display the metadata for the query 3659 http Step6: Show the output from...
12,328
<ASSISTANT_TASK:> Python Code: def countdown(n): print '> counting down from {}'.format(n) while n > 0: yield n n -= 1 print '' print '< countdown' for n in countdown(10): print n, # calling generator fucntion creates the generator object not start the function x = countdown(3) prin...
<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: generator 함수를 호출하는것은 generator 객체를 생성하는것이지 함수를 실행하는 것이 아님 Step3: tail -f (python version) Step4: Coroutine Step6: next() 는 까먹기 쉬우니까 decorator...
12,329
<ASSISTANT_TASK:> Python Code: import numpy as np import h5py from sklearn import svm, cross_validation, preprocessing # First we load the file file_location = '../results_database/text_wall_street_big.hdf5' run_name = '/low-resolution' f = h5py.File(file_location, 'r') # Now we need to get the letters and align them...
<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 load the file Step2: Accuracy with non-normalized SLM Step3: Accuracy with normalized SLM
12,330
<ASSISTANT_TASK:> Python Code: running_id = 0 output = [[0]] with open("E:/output.txt") as file_open: for row in file_open.read().split("\n"): cols = row.split(",") if cols[0] == output[-1][0]: output[-1].append(cols[1]) output[-1].append(True) else: outpu...
<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: Problems Step2: If we want to look at covariates, we need a new approach. We'll use Cox proprtional hazards. More information here. Step3: O...
12,331
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'sandbox-3', 'aerosol') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributo...
<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...
12,332
<ASSISTANT_TASK:> Python Code: print('Hello world!') print(list(range(5))) import numpy as np # To proceed, implement the missing code, and remove the 'raise NotImplementedException()' ##### Implement this part of the code ##### raise NotImplementedError("Code not implemented, follow the instructions.") # three = ? 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: Imports Step2: Parts to be implemented Step3: Numpy arrays Step4: Notice how we used print(f"foo {bar}") to enter a variable bar into the pri...
12,333
<ASSISTANT_TASK:> Python Code: from __future__ import division, absolute_import, print_function from pytz import timezone import elasticsearch import elasticsearch.helpers from idb import config from idb.helpers.logging import idblogger from idb.helpers.conversions import fields, custom_mappings # u = "4dce41dc-2af6-4...
<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: u is the uuid of the recordset that we wish to delete Step2: This from Nathan's example of deleting a mediarecord where we need the parent reco...
12,334
<ASSISTANT_TASK:> Python Code: ##1년은 52주로 구성됨 week = list(range(1, 53)) #range 함수의 첫 번째 파라매터에는 시작할 숫자, 두 번째 파라매터에는 끝나는 숫자보다 1 큰 수를 넣어줌 week len(week) ##한 주는 7일로 구성되어 있으므로 첫 번째 주의 가운데 날인 4번째 일을 그 주의 대표값(일)로 표시 (두 번째 주의 대표일은 11일) representative_day = list(range(4, 365, 7))#range의 세 번째 파라매터에는 간격이 들어감 representative_day 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: 각 주의 대표일 리스트 만들기 Step2: 난수생성기 Step3: 난수 생성으로 검색량 리스트 만들기 Step4: 데이터 프레임 만들기 Step5: 일 단위 데이터로 늘리기 Step6: 실제 데이터로 생성 Step7: 나중에 plot을 배우면 더 ...
12,335
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np import os from xgboost import XGBRegressor from sklearn.linear_model import LinearRegression from sklearn.svm import SVR, LinearSVR from sklearn.model_selection import GridSearc...
<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 data Step2: Make fuel price a ratio of the coal price to the natural gas price Step3: One-hot encoding of the cluster variable Step4: ...
12,336
<ASSISTANT_TASK:> Python Code: %run ../../utils/load_notebook.py from instabilities import * import numpy as np He_coeff = 1.34 def flat_end(argument): '''декоратор для того, чтобы продолжать функцию на уровне последнего значения''' def real_decorator(function): def wrapper(*args, **kwargs): ...
<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: Коэффициент для учета вклада гелия в массу газа (см. Notes) Step2: Для большой оси Step3: Для случая бесконечного тонкого диска Step4: Два др...
12,337
<ASSISTANT_TASK:> Python Code: import importlib autograd_available = True # if automatic differentiation is available, use it try: import autograd except ImportError: autograd_available = False pass if autograd_available: import autograd.numpy as np from autograd import grad, hessian else: 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: Specify the function to minimize as a simple python function.<br> Step2: Plot the function as a 2d surface plot. Different colors indicate diff...
12,338
<ASSISTANT_TASK:> Python Code: %matplotlib inline import sys import os import matplotlib.pyplot as plt from matplotlib import dates from odm2api.ODMconnection import dbconnection from odm2api.ODM2.services.readService import * # Create a connection to the ODM2 database # ---------------------------------------- odm2db_...
<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: SamplingFeatures tests Step2: Back to the rest of the demo
12,339
<ASSISTANT_TASK:> Python Code: from __future__ import print_function from numpy import * from matplotlib.pylab import * %pylab --no-import-all inline a1 = array([1.0, 2.0, 3.0]) a2 = arange(1.0, 5.0, 0.5) a3 = linspace(1.0, 10.0, 17) print(a1) print(a2) print(a3) m1 = array([[1.0, 2.0], [3.0, 4.0]]) print...
<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: NumPy Arrays Step2: Create arrays with array, ones, zeros, empty. Step3: Arrays can be accessed like lists (index, slicing). Step4: Math oper...
12,340
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import matplotlib.pyplot as plt import pandas as pd import numpy as np from scipy import stats from scipy.stats import norm #Valores da tabela y=[-1,0,1] #colunas x=[-0.25,0,0.25] #linhas probXY=[[[] for i in range(3)] for i in range(3)] pxy=[0.05,0.07,0.26,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: <font color='blue'>Exercício 1 - Exemplo 3 da Aula 17 </font> Step2: <font color='blue'>Exercício 2 - Soma de normais correlacionadas</font> St...
12,341
<ASSISTANT_TASK:> Python Code: pip install looker_sdk import looker_sdk #Note that the pip install required a hyphen but the import is an underscore. import os #We import os here in order to manage environment variables for the tutorial. You don't need to do this on a local system or anywhere you can more conveniently ...
<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: Configuring & Initializing the SDK Step2: Now that we've set all the necessary environment variables, we should be able to initialize the Looke...
12,342
<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: Retrain a classification model for Edge TPU with quant-aware training (TF 1.15) Step2: Clone the model and training repos Step3: Convert train...
12,343
<ASSISTANT_TASK:> Python Code: strat_train_set_copy = strat_train_set.copy() housing.plot(kind="scatter", x='longitude', y='latitude') housing.plot(kind="scatter", x='longitude', y='latitude', alpha=0.1) strat_train_set_copy.plot(kind='scatter', x='longitude', y='latitude', alpha=0.4, s=strat_...
<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: Experimenting with Attribute Combinations Step2: 2.5 Prepare the Data for Machine Learning Algorithms Step3: Handling Text and Categorical Att...
12,344
<ASSISTANT_TASK:> Python Code: # Define paths to model files import os MODELS_DIR = 'models/' if not os.path.exists(MODELS_DIR): os.mkdir(MODELS_DIR) MODEL_TF = MODELS_DIR + 'model' MODEL_NO_QUANT_TFLITE = MODELS_DIR + 'model_no_quant.tflite' MODEL_TFLITE = MODELS_DIR + 'model.tflite' MODEL_TFLITE_MICRO = MODELS_DI...
<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: Setup Environment Step2: Import Dependencies Step3: Dataset Step4: 2. Add Noise Step5: 3. Split the Data Step6: Training Step7: 2. Train t...
12,345
<ASSISTANT_TASK:> Python Code: from shenfun import * N = 8 T = FunctionSpace(N, 'Chebyshev', domain=(-1, 1)) u = Function(T) T = FunctionSpace(N, 'Chebyshev', domain=(0, 1)) T = FunctionSpace(N, 'Chebyshev', domain=(-1, 1)) u = Function(T, val=1) import sympy as sp x = sp.Symbol('x', real=True) u = Function(T, buff...
<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 function $u(x)$ can now be created with all N coefficients Step2: When using Chebyshev polynomials the computational domain is always Step3...
12,346
<ASSISTANT_TASK:> Python Code: from pybotics.robot import Robot from pybotics.predefined_models import ur10 robot = Robot.from_parameters(ur10()) import numpy as np np.set_printoptions(suppress=True) joints = np.deg2rad([5,5,5,5,5,5]) pose = robot.fk(joints) display(pose) solved_joints = robot.ik(pose) display(np.rad...
<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: Forward Kinematics Step2: Inverse Kinematics
12,347
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd seriesLabel = ['label1', 'label2', 'label3'] exampleList = [5, 10, 20] pd.Series(exampleList) pd.Series(exampleList, seriesLabel) exampleNumpyArray = np.array([6, 12, 18]) pd.Series(exampleNumpyArray) pd.Series(exampleNumpyArray, seriesLabel) exam...
<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: Series Step2: Using Numpy Arrays Step3: Using Dictionary Step4: Data and Index Parameter in Series Step5: Index Step6: DataFrames Step7: S...
12,348
<ASSISTANT_TASK:> Python Code: import numpy as np np.set_printoptions(precision=3) import matplotlib.pyplot as plt import math import os import warnings import pandas as pd # from scipy.interpolate import BSpline # from scipy.stats import gaussian_kde !mkdir figures !pip install -q numpyro@git+https://github.com/pyro-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: Data Step2: Empirical mean and std. Step3: Model Step4: Posterior samples. Step5: posterior marginals. Step6: Laplace approximation Step7: ...
12,349
<ASSISTANT_TASK:> Python Code: import json import numpy as np import pandas as pd from jupyter_scisheets_widget import scisheets_widget import pandas_datareader as pdr ibm_data = pdr.get_data_yahoo('IBM') income_data = pd.read_csv('income_data.csv', sep=';') income_data tbl2 = scisheets_widget.HandsonDataFrame(income...
<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 data into the notebook Step2: Display the loaded data as a scisheet widget Step3: Sanity check to explore df functionality
12,350
<ASSISTANT_TASK:> Python Code: import numpy as np from flare.gp import GaussianProcess # make gp model hyps = np.array([0.1, 1, 0.01]) hyp_labels = ['Signal Std', 'Length Scale', 'Noise Std'] cutoffs = {'threebody':3.9} gp = \ GaussianProcess(kernels=['threebody'], hyps=hyps, ...
<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: Some Explanation about the parameters Step2: Step 3 Step3: Some Explanation about the parameters Step4: After OTF training is finished, we ca...
12,351
<ASSISTANT_TASK:> Python Code: # suposing the datset is downloaded here workdir = '/media/samuel/dataspikesorting/DataSpikeSortingHD2/kampff/ultra dense/' filename = workdir + 'T2/amplifier2017-02-08T21_38_55.bin' %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import tridesclous as tdc from tri...
<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: create a DataIO (and remove if already exists) Step2: CatalogueConstructor Step3: Noise measurement Step4: Inspect waveform quality at catalo...
12,352
<ASSISTANT_TASK:> Python Code: import sklearn.svm as svm ### BEGIN SOLUTION ### END SOLUTION try: train_svm except: assert False else: assert True import numpy as np np.random.seed(598497) X = np.random.random((20, 2)) y = np.random.randint(2, size = 20) m1 = train_svm(X, y, 10000.0) assert m1.C == 10000.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: B Step2: C
12,353
<ASSISTANT_TASK:> Python Code: %matplotlib inline from __future__ import print_function from statsmodels.compat import lmap import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm norms = sm.robust.norms def plot_weights(support, weights_func, xlabels, xticks): 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: An M-estimator minimizes the function Step2: Andrew's Wave Step3: Hampel's 17A Step4: Huber's t Step5: Least Squares Step6: Ramsay's Ea St...
12,354
<ASSISTANT_TASK:> Python Code: import os.path as op import numpy as np import mne data_path = mne.datasets.sample.data_path() fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(fname) raw.set_eeg_reference('average', projection=True) # set EEG average reference order = 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: In MNE, epochs refers to a collection of single trials or short segments Step2: To create time locked epochs, we first need a set of events tha...
12,355
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nims-kma', 'sandbox-3', 'land') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "e...
<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...
12,356
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn plt.rcParams['figure.figsize'] = 9, 6 from sklearn import datasets, svm from sklearn.feature_selection import SelectPercentile, f_classif iris = datasets.load_iris() iris.data.shape ...
<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: Skusme najskor priklad toho ako by sme z nejakeho datasetu vyberali najdolezitejsie atributy pomocou filtra Step2: Pouzijeme oblubeny dataset k...
12,357
<ASSISTANT_TASK:> Python Code: %pylab inline from keras.layers.core import Dense, Activation from keras.models import Sequential from keras.utils import np_utils from sklearn.cross_validation import train_test_split from sklearn.datasets.samples_generator import make_blobs from sklearn.metrics import classification_rep...
<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: Generate data Step2: Split the data into training and test set Step3: Create the model Step4: Train the model Step5: Evaluate the model
12,358
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-1', 'atmoschem') # 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...
12,359
<ASSISTANT_TASK:> Python Code: def print_n_numbers(n): #TODO: write a loop that prints numbers from 0 to n (excluding n) for i in xrange(n): print(i) # now we execute the function print_n_numbers(5) def print_list(ll): # Prints the list print('\n'.join(ll)) print_list(['Visual Turing 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: The function below print each element in the list in a new line. We will use this function later, so please run the interpreter over the followi...
12,360
<ASSISTANT_TASK:> Python Code: import numpy as np a = np.array([11,1,2,3,4,5,12,-3,-4,7,4]) print('a = ',a) print('np.clip(a,0,10) = ', np.clip(a,0,10)) a = np.arange(10).astype(np.int) print('a=',a) print('np.clip(a,2.5,7.5)=',np.clip(a,2.5,7.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: Step1: Exemplo com ponto flutuante
12,361
<ASSISTANT_TASK:> Python Code: import numpy as np from scipy.stats import norm import matplotlib import matplotlib.pyplot as plt # plotting options font = {'size' : 20} plt.rc('font', **font) plt.rc('text', usetex=matplotlib.checkdep_usetex(True)) matplotlib.rc('figure', figsize=(18, 6) ) # capacity of the BSC 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: Step1: Binary Symmetric Channel (BSC) Step2: The finite-length capacity for the BSC channel is given by Step3: Show finite length capacity estimates ...
12,362
<ASSISTANT_TASK:> Python Code: %%javascript $.getScript('misc/kmahelona_ipython_notebook_toc.js') fn = r"data/drinks.csv" # Answer: df = pd.read_csv(fn, sep=",") # Answer: df.head(10) # Answer df.sort_values("total_litres_of_pure_alcohol", ascending=False).head() # Answer # df.groupby("continent").beer_servings.me...
<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 and Knowing your Data Step2: Task Step3: Task Step4: Groupby Step5: Task Step6: Task Step7: Task Step8: Task Step9: Task Step10:...
12,363
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-1', 'seaice') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "ema...
<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...
12,364
<ASSISTANT_TASK:> Python Code: from IPython.parallel import Client %pylab inline client = Client() client.block = True # Computations run synchronously. print client.ids dview = client.direct_view() def f(x): return x dview.apply(f, "Hello World") even_dview = client[::2] even_dview.apply(f, "Hello World") bvie...
<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: Before we start, we first need to assign a number of engines in our cluster. This can be done through the IPython notebook interface or through ...
12,365
<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.emni...
<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: 단일 머신 시뮬레이션
12,366
<ASSISTANT_TASK:> Python Code: from pred import Predictor from pred import sequence_vector from pred import chemical_vector par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"] benchmarks = ["Data/Training/phos_CDK1.csv", "Data/Training/phos_CK2.csv", "Data/Training/phos_MAPK1.csv", "Data/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: Step1: Controlling for Random Negatve vs Sans Random in Imbalanced Techniques using S, T, and Y Phosphorylation. Step2: Y Phosphorylation Step3: T Ph...
12,367
<ASSISTANT_TASK:> Python Code: #mean and std of multivariate normal dist to generate samples mu=np.array([5,0,-2]) σ=np.array([[9,1, -1], [1, 3, -2], [-1, -2,2],]) if not is_covariance(σ): print("Warning: σ is not a valid covariance matrix (not symmetric or positive definite)") n=1000 # numb...
<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: Transform the generated data $x$ to a new basis. Step2: Generate another dataset $y$ with the same distribution as $x$ (this is a very strong ...
12,368
<ASSISTANT_TASK:> Python Code: %%writefile train.py print("hello world!") job = TrainJob("train.py", backend=KubeflowGKEBackend()) job.submit() def train(): print("simple train job!") job = TrainJob(train, backend=KubeflowGKEBackend()) job.submit() %%writefile requirements.txt papermill jupyter job = TrainJob("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: Step1: Executing a python function Step2: Executing a complete notebook Step3: Executing it with large #CPUs and huge Memory
12,369
<ASSISTANT_TASK:> Python Code: n=RichStr("I am ", "normal") n r=RichStr("RED", sheet=groups["Fore"]["red"]) r=RichStr("RED", sheet=groups.Fore.red) str(r) print(r) print(r.toHTML()) IPython.display.display_html(r.toHTML(), raw=True) pureRed=RGBColor("PureRed", 0xFF, bg=True) prs=RichStr("Pure red", sheet=pureRed) ...
<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: __repr__esentation of a rich string shows a "flat" representation of a RichStr - a sequence of styles and strings where style applies to everyth...
12,370
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-3', 'aerosol') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "ema...
<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...
12,371
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.cm as cm import matplotlib.pyplot as plt import pandas as pd pd.set_option('display.width', 500) pd.set_option('display.max_columns', 100) pd.set_option('display.notebook_repr_html', True) ...
<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: Explore Step3: The Vector space model and a search engine. Step4: Naive Bayes Step5: The accuracy score is good for...
12,372
<ASSISTANT_TASK:> Python Code: DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' class DLProgress(tqdm): last_b...
<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: Image Classification Step2: Explore the Data Step5: Implement Preprocess Functions Step8: One-hot encode Step10: Randomize Data Step12: Che...
12,373
<ASSISTANT_TASK:> Python Code: import requests from bs4 import BeautifulSoup def listFD(url, ext=''): page = requests.get(url).text soup = BeautifulSoup(page, 'html.parser') return [url + node.get('href') for node in soup.find_all('a') if node.get('href').endswith(ext)] site = 'http://people.du...
<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. (25 points) Accelerating CPU bound procedures Step2: 3. (25 points) Use C++ to
12,374
<ASSISTANT_TASK:> Python Code: import o2sclpy import matplotlib.pyplot as plot import ctypes import numpy import sys plots=True if 'pytest' in sys.modules: plots=False link=o2sclpy.linker() link.link_o2scl() cu=link.o2scl_settings.get_convert_units() b=o2sclpy.eos_tov_buchdahl(link) ts=o2sclpy.tov_solve(link) 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: Link the O$_2$scl library Step2: Get a copy (a pointer to) the O$_2$scl unit conversion object Step3: Create the Buchdahl EOS object Step4: C...
12,375
<ASSISTANT_TASK:> Python Code: %pylab inline import speclite print(speclite.version.version) import bossdata print(bossdata.__version__) finder = bossdata.path.Finder() mirror = bossdata.remote.Manager() spAll = bossdata.meta.Database(lite=True) sky_table = spAll.select_all(where='PLATE=6641 and OBJTYPE="SKY"') print(...
<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: Stacked Sky Step2: Plot a stacked spectrum Step3: Stack individual Spec-lite files Step4: Stack Spectra from one Plate file Step5: Stacked Q...
12,376
<ASSISTANT_TASK:> Python Code: # Execute this cell to load the notebook's style sheet, then ignore it from IPython.core.display import HTML css_file = '../style/custom.css' HTML(open(css_file, "r").read()) print("Hello World!") x = 2**8 x < 64 str_1 = 'hello' str_2 = 'world' new_string = str_1 + str_2 print(new_stri...
<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: Play with data in Jupyter Step2: Edit mode and Command mode Step3: Remember that we can concatenate strings ("add"), for example Step4: What ...
12,377
<ASSISTANT_TASK:> Python Code: # Imports # Numeric Packages from __future__ import division import numpy as np import pandas as pd import scipy.stats as sps # Plotting packages import matplotlib.pyplot as plt from matplotlib import ticker import seaborn as sns %matplotlib inline sns.set_style('whitegrid') sns.set_conte...
<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: 0. References Step2: 1.3 What results did you get from this statistical test? These should include the following numerical values Step3: 1.4 W...
12,378
<ASSISTANT_TASK:> Python Code: import os PROJECT = 'cloud-training-demos' # CHANGE THIS REGION = 'us-central1' # Choose an available region for Cloud MLE from https://cloud.google.com/ml-engine/docs/regions. BUCKET = 'cloud-training-demos-ml' # REPLACE WITH YOUR BUCKET NAME. Use a regional bucket in the region you 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: <h1> 1. Command-line parameters to task.py </h1> Step2: <h1> 2. Evaluation metric </h1> Step3: <h1> 3. Make sure outputs do not clobber each o...
12,379
<ASSISTANT_TASK:> Python Code: from __future__ import print_function, division, unicode_literals import oddt from oddt.shape import usr, usr_similarity print(oddt.__version__) heroin = oddt.toolkit.readstring('smi', 'CC(=O)Oc1ccc2c3c1O[C@@H]4[C@]35CC[NH+]([C@H](C2)[C@@H]5C=C[C@@H]4OC(=O)C)C') smiles = ['CC(=O)Oc1...
<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'd like to compare the shape of heroin with other molecules. Step2: To compute the shape using USR we need the molecule's 3D coordinates. Ste...
12,380
<ASSISTANT_TASK:> Python Code: # Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) import datetime agora = datetime.datetime.now() agora t = datetime.time(7, 43, 28) print (t) print ('Hora :', t.hour) print ('Minute:', 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: Datetime
12,381
<ASSISTANT_TASK:> Python Code: import sys sys.path.insert(0, "../..") from insights.core import dr # Here's our component type with the clever name "component." # Insights Core provides several types that we'll come to later. class component(dr.ComponentType): pass import random # Make two components with no depen...
<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 do I use it? Step2: Component Types Step3: Component Invocation Step4: Notice that broker can be used as a dictionary to get the value of...
12,382
<ASSISTANT_TASK:> Python Code: import os PROJECT = !(gcloud config get-value core/project) PROJECT = PROJECT[0] BUCKET = PROJECT os.environ["BUCKET"] = BUCKET %%writefile tpu_models/trainer/task.py TPU trainer command line interface import argparse import sys import tensorflow as tf from . import model, util def _pars...
<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: Packaging the Model Step5: The TPU server Step6: This model is still compressed, so lets uncompress it with the tar command below and place it...
12,383
<ASSISTANT_TASK:> Python Code: def pass_through(x): return x data_lm = load_data(path, bs=120) learn = language_model_learner(data=data_lm, arch=AWD_LSTM, pretrained=False) learn.lr_find() learn.recorder.plot() best_lr = 1e-2 * 2 escb = EarlyStoppingC...
<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. Instantiate Language Model Step2: 3. Train Language Model Step3: Define callbacks Step4: Train Model
12,384
<ASSISTANT_TASK:> Python Code: from __future__ import print_function import concarne import concarne.patterns import concarne.training import lasagne import theano.tensor as T %pylab inline try: import sklearn.linear_model as sklm except: print ( You don't have scikit-learn installed; install it to compare lear...
<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 example illustrates how simple it is to train a classifier using Step2: Data generation Step3: Now let's define some side information Ste...
12,385
<ASSISTANT_TASK:> Python Code: global PASSWORD PASSWORD = "Guild o' Code" def halver(num): Returns half of the 'num' argument. # docstring return num / 2 print "halver's name:", halver.__name__ print "halver's docstring:", halver.__doc__ halver? print halver(20) print halver(10) print halver(5) print [i/2 f...
<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: function Step3: function object Step4: Uh-oh... Step6: wrapper Step8: decorator Step9: Dust off your hands and kick back. We're completely...
12,386
<ASSISTANT_TASK:> Python Code: # TODO: add putty connection too. #read SSH connection parameters with open('ssh_settings.json') as settings_file: settings = json.load(settings_file) hostname = settings['hostname'] username = settings['username'] password = settings['password'] local_key_dir = settings['local_k...
<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: This notebook explores merged craigslist listings/census data and fits some initial models Step7: Data Preparation Step8: create variables Ste...
12,387
<ASSISTANT_TASK:> Python Code: def reArrange(words , n ) : mp = { } for i in range(n ) : mp[words[i ] ] = i + 1  words . sort() ; for i in range(n ) : print(mp[words[i ] ] , end = "▁ ")   words =["live ", "place ", "travel ", "word ", "sky "] n = len(words ) reArrange(words , n ) ; <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:
12,388
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pickle as pkl import numpy as np import tensorflow as tf import matplotlib.pyplot as plt print(tf.__version__) from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data') def model_inputs(real_dim, z_dim): input...
<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: Model Inputs Step2: Generator network Step3: Discriminator Step4: Hyperparameters Step5: Build network Step6: Discriminator and Generator L...
12,389
<ASSISTANT_TASK:> Python Code: # Import Parsl import parsl from parsl import * print(parsl.__version__) # The version should be v0.2.1+ workers = ThreadPoolExecutor(max_workers=4) # We pass the workers to the DataFlowKernel which will execute our Apps over the workers. dfk = DataFlowKernel(executors=[workers]) @App('...
<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 resources Step2: Defining Bash Apps Step3: Running Bash Apps Step4: Handling Futures Step5: Retrieving Results Step6: Defining a Sec...
12,390
<ASSISTANT_TASK:> Python Code: from __future__ import print_function from __future__ import division import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.layers.con...
<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 up the parameters for the model. Nothing too exciting here. Step2: Below we build the neural network. This is the same network used in th...
12,391
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import matplotlib.pyplot as plt np.random.seed(42) y = np.random.random(10000) x = 1./np.sqrt(y) plt.hist(x, bins=100, range=(1,10), histtype='stepfilled',color='blue') plt.yscale('log') def nllp(a) # here define the function return 1. 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: Generate a dataset to be fitted Step2: Maximum likelihood fit of a simple power law Step3: Then minimize it using iminuit Step4: Error analys...
12,392
<ASSISTANT_TASK:> Python Code: !pip install git+https://github.com/google/starthinker from starthinker.util.configuration import Configuration CONFIG = Configuration( project="", client={}, service={}, user="/content/user.json", verbose=True ) FIELDS = { 'auth':'service', # Credentials used for writing 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: 2. Set Configuration Step2: 3. Enter Census Data Correlation Recipe Parameters Step3: 4. Execute Census Data Correlation
12,393
<ASSISTANT_TASK:> Python Code: import warnings import numpy as np import openpnm as op from openpnm.algorithms import MixedInvasionPercolation as mp import matplotlib.pyplot as plt np.random.seed(10) from ipywidgets import interact, IntSlider warnings.simplefilter("ignore") %matplotlib inline ws = op.Workspace() ws.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: The Mixed Invasion Percolation algorithm therefore requires a physics associated with its invading phase that contains both a pore and throat en...
12,394
<ASSISTANT_TASK:> Python Code: # Load regex package import re # Create a variable containing a text string text = 'Chris: 12:34am. Steve: 16:30' # Find any text that fits the regex re.findall(r'([0-1]\d:[0-5]\d)\s*(?:AM|PM)?', text) <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: Create some text Step2: Apply regex
12,395
<ASSISTANT_TASK:> Python Code: %pylab notebook Sw = 10e3 # [VA] Vp = 600 # [V] Vh = 480 # [V] which is also the load voltage Vl = 120 # [V] n = Vh/Vl # = Nc/Nse n Sio = (1 + n)/1 * Sw print(''' Sio = {:.1f} kVA ============== '''.format(Sio/1000)) Ip = Sio/Vp print(''' Ip = {:.1f} A =========== '''.format(Ip...
<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: Description Step2: (a) Step3: (c) Step4: and the maximum secondary current is
12,396
<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: <table class="tfo-notebook-buttons" align="left"> Step2: About YAMNet Step3: With the model loaded, you can follow the YAMNet basic usage tuto...
12,397
<ASSISTANT_TASK:> Python Code: %load_ext watermark %watermark -u -v -d -p matplotlib,numpy %matplotlib inline import numpy as np import random from matplotlib import pyplot as plt data = np.random.normal(0, 20, 1000) # fixed bin size bins = np.arange(-100, 100, 5) # fixed bin size plt.xlim([min(data)-5, max(data)+5]...
<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: <font size="1.5em">More info about the %watermark extension</font> Step2: <br> Step3: <br> Step4: <br> Step5: <br> Step6: Via the numpy.his...
12,398
<ASSISTANT_TASK:> Python Code: import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) pr...
<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: By default, Step3: Step4: Preprocessing Step5: Once we're confident about which component(s) we want to remove, we pas...
12,399
<ASSISTANT_TASK:> Python Code: import numpy as np import bet.sensitivity.gradients as grad import bet.sensitivity.chooseQoIs as cqoi import bet.calculateP.simpleFunP as simpleFunP import bet.calculateP.calculateP as calculateP import bet.postProcess.postTools as postTools import bet.Comm as comm import bet.sample as 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: Define Methods Step2: Suggested Changes Step3: With these gradient vectors, we are now ready to choose an optimal set of QoIs to use in the in...