Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
14,100
<ASSISTANT_TASK:> Python Code: from mosasaurus.Target import Target # load a target from SIMBAD t = Target(starname='GJ1132', name='GJ1132b') t.summarize() t.star.summarize() # create a target from values (in case you want to work offline) import astropy.units as u t = Target(starname='GJ1132', name='GJ1132b', ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Determine the basic properties of this instrument. Step2: Determine the basic properties of this night, including a nightly observing log. Step...
14,101
<ASSISTANT_TASK:> Python Code: import rebound import reboundx import astropy.units as u import astropy.constants as constants import numpy as np import matplotlib.pyplot as plt sim = rebound.Simulation() sim.units = ('yr', 'AU', 'Msun') sim.add(m = 1) a0=1 sim.add(m = 1.e-4, a=a0, e=0, inc = 0) sim.move_to_com() ps = 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: Now we add the type_I_migration effect, and set the appropriate disk parameters. Note that we chose code units of AU for all the distances above...
14,102
<ASSISTANT_TASK:> Python Code: # Authors: Eric Larson <larson.eric.d@gmail.com> # # License: BSD-3-Clause from os import path as op import mne from mne.preprocessing import maxwell_filter print(__doc__) data_path = op.join(mne.datasets.misc.data_path(verbose=True), 'movement') head_pos = mne.chpi.read_head_pos(op.join(...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Visualize the "subject" head movements. By providing the measurement Step2: This can also be visualized using a quiver. Step3: Process our sim...
14,103
<ASSISTANT_TASK:> Python Code: # import some useful packages import numpy as np import matplotlib.pyplot as plt import seaborn import networkx as nx import pandas as pd import random import json # latex rendering of text in graphs import matplotlib as mpl mpl.rc('text', usetex = False) mpl.rc('font', family = 'serif') ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Test drug_gene_heatprop module Step2: More detailed description of methods below... Step3: What is this drug-gene graph like? Step4: But we p...
14,104
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import sys sys.path.insert(0,'../code/functions/') import tiffIO as tIO import connectLib as cLib import plosLib as pLib import time import scipy.ndimage as ndimage import numpy as np import scipy.ndimage as ndimage class ClusterComponen...
<SYSTEM_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 Actual Code Step2: I will be using the below cell for analyzing Cluster Component's Performance Step3: Cluster Components Conditions Step4...
14,105
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import numpy as np %matplotlib inline from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split( digits.data, digits.target, random_state=0) 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: Really Simple API Step2: 1) Instantiate an object and set the parameters Step3: 2) Fit the model Step4: 3) Apply / evaluate Step5: And again...
14,106
<ASSISTANT_TASK:> Python Code: import numpy as np import logging from scipy.stats import norm import dora.active_sampling as sampling import time from dora.active_sampling import pltutils import matplotlib.pyplot as pl import matplotlib as mpl %matplotlib inline def ground_truth(X): return np.sin(X-5) + np.sin(X/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: Problem Setup Step2: Next we need to set the bounds for the problem. In this example, the space is one dimensional. So the upper and lower boun...
14,107
<ASSISTANT_TASK:> Python Code: DON'T MODIFY ANYTHING IN THIS CELL import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) view_sentence_range = (0, 10) DON'T MODIFY AN...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Language Translation Step3: Explore the Data Step6: Implement Preprocessing Function Step8: Preprocess all the data and save it Step10: Chec...
14,108
<ASSISTANT_TASK:> Python Code: #import statements from keras.layers.core import Dense, Activation, Dropout from keras.layers.recurrent import LSTM from keras.models import Sequential import lstm, time import pandas as pd import matplotlib as plt from sklearn.preprocessing import StandardScaler import numpy as np #read ...
<SYSTEM_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 is what our data looks like Step3: now we can proceed with the analysis Step4: TRAINING TIME!
14,109
<ASSISTANT_TASK:> Python Code: import numpy as np import IEtools import pylab as pl %pylab inline filename1='C:/econdata/GDP.xls' filename2='C:/econdata/PAYEMS.xls' filename3='C:/econdata/CPIAUCSL.xls' gdp = IEtools.FREDxlsRead(filename1) lab = IEtools.FREDxlsRead(filename2) cpi = IEtools.FREDxlsRead(filename3) pl.pl...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Read in the files Step2: Here's a plot of nominal GDP Step3: And here is nominal GDP growth Step4: Fit information equilibrium parameters Ste...
14,110
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt from scipy.signal import medfilt import gitInformation from neo.io import NeuralynxIO % matplotlib inline gitInformation.printInformation() # Session folder with all needed neuralynx files sessionfolder = 'C:\\Users\\Dominik\\Documents\\G...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Filter data with different window lenghts. Step2: Calculate the threshold for each filtered data Step3: Plot Each data and the threshold Step4...
14,111
<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"> Step3: If you're putting a nontrivial chunk of forward pass code into the shim, you want to k...
14,112
<ASSISTANT_TASK:> Python Code: from os.path import join, expandvars from joblib import Parallel, delayed from tax_credit.framework_functions import (runtime_make_test_data, runtime_make_commands, clock_runtime, ...
<SYSTEM_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 test datasets Step2: Preparing the method/parameter combinations Step3: Generate the list of commands and run them Step4: Next, we w...
14,113
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np Pleiades_NIR = np.genfromtxt('../Projects/pleiades_colors/data/Stauffer_Pleiades_nir.dat', usecols=(2, 3, 5, 6, 8, 9)) # J, errJ, H, errH, K, errK dist_mod = 5.62 # distance modulus for 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: Solar Abundances and NIR Broadband Photometric Colors Step2: Now we'll need to load appropriate stellar evolution isochrones with bolometric co...
14,114
<ASSISTANT_TASK:> Python Code: try: if __IPYTHON__: # this is used for debugging purposes only. allows to reload classes when changed get_ipython().magic(u'load_ext autoreload') get_ipython().magic(u'autoreload 2') except NameError: print('Not IPYTHON') pass import sys 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: <h1> Using the workload manager SLURM </h1> Step2: <b> We can see here that the number of processes are the number of core your computer posses...
14,115
<ASSISTANT_TASK:> Python Code: #Load blast hits blastp_hits = pd.read_csv("2_blastp_hits.csv") blastp_hits.head() #Filter out Metahit 2010 hits, keep only Metahit 2014 blastp_hits = blastp_hits[blastp_hits.db != "metahit_pep"] #Assumes the Fasta file comes with the header format of EMBOSS getorf fh = open("1_orf/d9539...
<SYSTEM_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. Process blastp results Step2: 2.2 Annotate blast hits with orf stats Step3: 2.3 Extract best hit for each ORF ( q_cov > 0.8 and pct_id > 40...
14,116
<ASSISTANT_TASK:> Python Code: from __future__ import division, print_function %matplotlib inline import numpy as np import matplotlib.pyplot as plt try: plt.style.use('ggplot') except: pass # We need distributions to model priors. from qinfer import distributions # The noisy coin model has already been implmented, 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: To get access to NumPy and matplotlib, IPython's %pylab magic command is quite useful. With the inline argument, all plots will be made a part o...
14,117
<ASSISTANT_TASK:> Python Code: # Authors: Jose C. Garcia Alanis <alanis.jcg@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from mne.datasets.limo import load_data from mne.stats import linear_regression from mne.viz import plot_events, plot_compare_evokeds from mne import comb...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: About the data Step2: Note that the result of the loading process is an Step3: Visualize events Step4: As it can be seen above, conditions ar...
14,118
<ASSISTANT_TASK:> Python Code: # Only needed in a Jupyter Notebook %matplotlib inline # Optional plot styling import matplotlib matplotlib.style.use('bmh') import matplotlib.pyplot as plt from pycalphad import equilibrium from pycalphad import Database, Model import pycalphad.variables as v import numpy as np db = 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: Al-Fe (Heat Capacity and Degree of Ordering) Step2: We also compute degree of ordering at fixed temperature as a function of composition. Step3...
14,119
<ASSISTANT_TASK:> Python Code: import _initpath import numpy import zerosum.balance data = numpy.array([ [1.0, 3.0, 0.5], [1.0 / 3.0, 1.0, 0.5], [2.0, 2.0, 1.0]]) names = ['Hammer', 'Spear', 'Curse'] data = 1.0 / data balance = zerosum.balance.HazardSymmetricBalance(data) result = balance.optimize() for...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Then we take the data as it appeared in Hazard's slides. The example given was symmetric, which means that the base matrix is log-skew-symmetric...
14,120
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-1', 'atmoschem') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("nam...
<SYSTEM_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...
14,121
<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()) # import SymPy libraries from sympy import symbols, differentiate_finite, Function # Define symbols x, h = sym...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Generalization of Taylor FD operators
14,122
<ASSISTANT_TASK:> Python Code: import os from time import time import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker import fitsio import seaborn as sns from speclite import filters from desitarget import desi_mask from desisim.io import read_basis_templates %pylab inline sns.set(style='...
<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: Read the targets catalog Step3: Read the templates and compute colors on a redshift grid. Step5: Generate some plots
14,123
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt try: import seaborn except ImportError: pass data = {'country': ['Belgium', 'France', 'Germany', 'Netherlands', 'United Kingdom'], 'population': [11.3, 64.3, 81.3, 16.9, 64.9], ...
<SYSTEM_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 notes on selecting data Step2: or multiple columns Step3: But, slicing accesses the rows Step4: So as a summary, [] provides the followi...
14,124
<ASSISTANT_TASK:> Python Code: from crpropa import * obs = Observer() obs.add(ObserverPoint()) obs.add(ObserverInactiveVeto()) t = TextOutput("photon_electron_output.txt", Output.Event1D) obs.onDetection(t) sim = ModuleList() sim.add(SimplePropagation()) sim.add(Redshift()) sim.add(EMPairProduction(CMB(),True)) sim.add...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: (Optional) plotting of the results Step2: Photon Propagation outside of CRPropa with EleCa and DINT Step3: The file 'photon_output.txt' will ...
14,125
<ASSISTANT_TASK:> Python Code: x = 1 x = 1.0 x = True x = "True" (1.0 + 2.0)*3 (100>0) and (1./3<1./2) a = 3 b = 4 c = (a**2 + b**2)**0.5 peri = a + b + c a = 1 b = a c = a + b a = c print a, b, c nombre = raw_input("Ingrese su nombre: ") edad = int(raw_input("Ingrese su edad [años]: ")) altura = float(raw_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: 1.2 Expresión Step2: Asignación Step3: Cálculo de expresión y luego asignación Step4: Asignación Step5: 2- Input y Output Step6: 2.2 Salida...
14,126
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy from numpy.random import choice from sklearn.datasets import load_boston from h2o.estimators.random_forest import H2ORandomForestEstimator import h2o h2o.init() # transfer the boston data from pandas to H2O boston_data = load_boston() X = pd.DataFrame(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: Enable inline plotting in the Jupyter Notebook Step2: Intro to H2O Data Munging Step3: View the top of the H2O frame. Step4: View the bottom ...
14,127
<ASSISTANT_TASK:> Python Code: # %load ./arguments.py #!/usr/bin/python import sys # it's easy to print this list of course: print sys.argv # or it can be iterated via a for loop: for i in range(len(sys.argv)): if i == 0: print "Function name: %s" % sys.argv[0] else: print "%d. argument: %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: Writing a Module Step2: This is a really simple equation, but by making this a function, we can make it more sophisticated or change the expone...
14,128
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 import glob from IPython.display import Image import numpy as np import openmc from openmc.statepoint import StatePoint from openmc.summary import Summary from openmc.source import Source from openmc.stats import Box %matplotlib inline # Instantiate som...
<SYSTEM_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 Input Files Step2: With the nuclides we defined, we will now create three materials for the fuel, water, and cladding of the fuel pin....
14,129
<ASSISTANT_TASK:> Python Code: import json import numpy as np import tensorflow.compat.v1 as tf import tqdm # Suppress noisy log messages. from tensorflow.python.util import deprecation deprecation._PRINT_DEPRECATION_WARNINGS = False AMINO_ACID_VOCABULARY = [ 'A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', '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: Step4: Library functions Step5: Download model and vocabulary Step6: Load the model into TensorFlow Step7: Load tensors for class prediction Step8: ...
14,130
<ASSISTANT_TASK:> Python Code: %load_ext sql from django.conf import settings connection_string = 'postgresql+psycopg2://{USER}:{PASSWORD}@{HOST}:{PORT}/{NAME}'.format( **settings.DATABASES['default'] ) %sql $connection_string %%sql SELECT cvr."FILING_ID", COUNT(DISTINCT cvr."FORM_TYPE") FROM "CVR_CAMPAIGN_DISCLOS...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Cover Sheets Step2: Do the FILER_ID values vary between amendments to the same any campaign filing? Step3: Joining to FILER_FILINGS_CD Step4: ...
14,131
<ASSISTANT_TASK:> Python Code: from __future__ import absolute_import from __future__ import division from __future__ import print_function import pandas as pd from model_tool import ToxModel SPLITS = ['train', 'dev', 'test'] wiki = {} debias = {} random = {} for split in SPLITS: wiki[split] = '../data/wiki_%s.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: Load Data Step2: Train Models Step3: Random model Step4: Plain wikipedia model Step5: Debiased model
14,132
<ASSISTANT_TASK:> Python Code: %matplotlib notebook # As an alternative, one may use: %pylab notebook # For old Matplotlib and Ipython versions, use the non-interactive version: # %matplotlib inline or %pylab inline # To ignore warnings (http://stackoverflow.com/questions/9031783/hide-all-warnings-in-ipython) import wa...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Useful keyboard shortcuts Step2: 3D plots Step3: Animations Step4: Interactive plots with Plotly Step5: IPython built-in magic commands Step...
14,133
<ASSISTANT_TASK:> Python Code: from time import time start_nb = time() # Initialize logging. import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s') sentence_obama = 'Obama speaks to the media in Illinois' sentence_president = 'The president greets the press in Chicago' sentence_obama = 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: These sentences have very similar content, and as such the WMD should be low. Before we compute the WMD, we want to remove stopwords ("the", "to...
14,134
<ASSISTANT_TASK:> Python Code: import torch from torch import nn import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) %matplotlib inline import matplotlib.pyplot as plt import torchsde def plot(ts, samples, xlabel, ylabel, title=''): ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Just like how each ordinary differential equation (ODE) is governed by a vector field, a stochastic differential equation (SDE) is governed by t...
14,135
<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 math import numpy as np import pandas as pd from thinkbayes2 import 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: The August birthday problem Step2: I'll roll the data so September comes first. Step3: Here are the diagnosis rates, which we can check agains...
14,136
<ASSISTANT_TASK:> Python Code: %matplotlib notebook import numpy as np from dh_py_access import package_api import dh_py_access.lib.datahub as datahub import xarray as xr import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from po_data_process import get_data_in_pandas_dataframe, make_plot,get_comp...
<SYSTEM_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='red'>Please put your datahub API key into a file called APIKEY and place it to the notebook folder or assign your API key directly ...
14,137
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import matplotlib as mp import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches qb_games = pd.read_csv('qb_games.csv') qb_games.columns.values qb_games['Fantasy Points'] = (qb_games['Pass Yds']/25) + (6 * qb_games['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: Calculate Fantasy Points Step2: Get the average QB fantasy points by year Step3: Observation Step4: Observation Step5: Observation Step6: O...
14,138
<ASSISTANT_TASK:> Python Code: # Utils import sys import os import shutil import time import pickle import numpy as np # Deep Learning Librairies import tensorflow as tf import keras.preprocessing.image as kpi import keras.layers as kl import keras.optimizers as ko import keras.backend as k import keras.models as km 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: La commande suivante permet de verifier qu'une carte GPU est bien disponible sur la machine utilisée. Si c'est le cas et si Keras a bien été ins...
14,139
<ASSISTANT_TASK:> Python Code: import sys import math import numpy as np import pandas as pd import scipy.optimize as so import scipy.integrate as si import matplotlib.pyplot as plt import nest %matplotlib inline plt.rcParams['figure.figsize'] = (12, 3) def Vpass(t, V0, gNaL, ENa, gKL, EK, taum, I=0): tau_eff = ta...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Neuron Model Step2: Agreement is excellent. Step3: Agreement is as good as possible Step5: ISIs are as predicted Step6: I_h channel Step7: ...
14,140
<ASSISTANT_TASK:> Python Code: import sys import os sys.path.append(os.environ.get('NOTEBOOK_ROOT')) import xarray as xr import numpy as np import datacube from utils.data_cube_utilities.data_access_api import DataAccessApi from datacube.utils.aws import configure_s3_access configure_s3_access(requester_pays=True) ap...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <span id="plat_prod">Choose Platforms and Products &#9652;</span> Step2: Choose product Step3: <span id="extents">Get the Extents of the Cube ...
14,141
<ASSISTANT_TASK:> Python Code: import numpy as np lst = [10, 20, 30, 40] arr = np.array([10, 20, 30, 40]) arr[0] lst[0] arr[-1] arr[2:] lst[-1] = 'a string inside a list' lst arr[-1] = 'a string inside an array' arr.dtype arr[-1] = 1.234 arr np.zeros(5, dtype=float) np.zeros(3, dtype=int) np.zeros(3, dtype=comple...
<SYSTEM_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 do this to save time with all future functions. Instead of needing to type (for example) Step2: Elements of a one-dimensional array are acce...
14,142
<ASSISTANT_TASK:> Python Code: import pandas as pd deaths_df = pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv') # Question 3 # Display first 5 rows # of the loaded data deaths_df.head(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: Question 3 Step2: ...and do a short summary about the data; Step3: Question 5 Step4: Question 6
14,143
<ASSISTANT_TASK:> Python Code: #|export from __future__ import annotations from fastai.torch_basics import * from torch.utils.data.dataloader import _MultiProcessingDataLoaderIter,_SingleProcessDataLoaderIter,_DatasetKind _loaders = (_MultiProcessingDataLoaderIter,_SingleProcessDataLoaderIter) #|hide from nbdev.showdoc...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: DataLoader helpers Step2: DataLoader - Step3: Arguments to DataLoader Step4: If you don't set bs, then dataset is assumed to provide an itera...
14,144
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') import datetime dt = datetime.datetime(year=2016, month=12, day=19, hour=13, minute=30) dt print(dt) # .day,... print(dt.strftime("%d %B %Y")) ts = pd.Timestamp('2016-12-19') ts ts.month ts ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Introduction Step2: Dates and times in pandas Step3: Like with datetime.datetime objects, there are several useful attributes available on the...
14,145
<ASSISTANT_TASK:> Python Code: import numpy as np import nashpy as nash import matplotlib.pyplot as plt A = np.array([[4, 3], [2, 1]]) game = nash.Game(A) timepoints = np.linspace(0, 10, 1000) epsilon = 10 ** -1 xs = game.replicator_dynamics( y0=[1 - epsilon, epsilon], timepoints=timepoints, ) plt.plot(xs); ...
<SYSTEM_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 case of $a>c$ Step2: The case of $a=c$ and $b>d$ Step3: $a=c$ and $b < d$ Step4: $a < c$ Step5: We see in the above case that the popula...
14,146
<ASSISTANT_TASK:> Python Code: import pensieve as pens import textacy from collections import defaultdict from random import random def make_markov_chain(docs): my_dict = defaultdict(list) inverse_dict = defaultdict(list) for doc in docs: print("Reading ",doc) d = pens.Doc(doc) for ...
<SYSTEM_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 our markiv hcain functions. First to create the dics. First attempt only takes triplets of words a b c and adds {'a b' Step2: Load the b...
14,147
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import pickle import seaborn as sns from pandas import DataFrame, Index from sklearn import metrics from sklearn.linear_model import SGDClassifier from sklearn.svm import SVC from sklearn.kernel_approximation import RBFSampler, Nystroem from sklearn....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Query by Committee Step2: Stochastic Gradient Descent Step3: Random selection of data points at each iteration. Step4: SVM with Random Sampli...
14,148
<ASSISTANT_TASK:> Python Code: for i in [1,2,3]: print(i) for ch in 'test': print(ch) for k in {1:'test1',2:'test'}: print(k) ",".join(["a","b","c"]) ",".join(('this','is','a','test')) ",".join({'key1':'value','key2':'value2'}) x = iter([1,2,3]) print(x) print(next(x)) print(next(x)) print(next(x)) 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: If we use it with a string, it loops over its characters. Step2: If use it with a dictionary, it loops over its keys Step3: So there are many ...
14,149
<ASSISTANT_TASK:> Python Code: import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va def checkerboard(size): Return a 2d checkboard of 0.0 and 1.0 as a NumPy array # YOUR CODE HERE raise NotI...
<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: Checkerboard Step3: Use vizarray to visualize a checkerboard of size=20 with a block size of 10px. Step4: Use vizarray to visualize a checkerb...
14,150
<ASSISTANT_TASK:> Python Code: from explauto.environment import environments print 'Available environments: {}'.format(environments.keys()) env_cls, env_configs, _ = environments['simple_arm'] print 'Available configurations for the simple arm environment: {}'.format(env_configs.keys()) config = env_configs['default'...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: According to your installation, you will see different available environments Step2: There are 4 different configurations for the simple arm (w...
14,151
<ASSISTANT_TASK:> Python Code: An example to store the output without "pickle" testfile = 'nopickle.txt' var1 = 1143 var2 = ["AECS", "LAYOUT", "KUNDALAHALLI"] var3 = 58.30 var4 = ("Bangalore", 560037) def ezhudhu(): with open(testfile, 'w+') as f: f.write(str(var1)) f.write(str(var2)) f.writ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Howto with examples on 'pickle' module ==> 28/May/2016 Step4: This is the content of nopickle.txt Step6: ** This is the content of pickle.tx...
14,152
<ASSISTANT_TASK:> Python Code: species = 'Mus_musculus' taxid = '10090' assembly = 'GRCm38.p6' genbank = 'GCF_000001635.26' sumurl = ('ftp://ftp.ncbi.nlm.nih.gov/genomes/all/{0}/{1}/{2}/{3}/{4}_{5}/' '{4}_{5}_assembly_report.txt').format(genbank[:3], genbank[4:7], genbank[7:10], ...
<SYSTEM_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 variables defined above can be modified for any other species, resulting in new results for the following commands. Step2: Sequences of eac...
14,153
<ASSISTANT_TASK:> Python Code: %matplotlib inline from pymatbridge import Octave octave = Octave() octave.start() %load_ext pymatbridge %%matlab load('Chap17_Data') %%matlab whos %%matlab fieldnames(spike) %%matlab size(spike(1).times) %%matlab size(spike(2).times) %nb de décharges pour l'essai 2 %%matlab size(sp...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Section 1 Step2: <ol start="2"> Step3: <font color="red">Quelles variables sont présentes? Quel est le type de la variable spike? Quelle est ...
14,154
<ASSISTANT_TASK:> Python Code: from collections import deque dq = deque() dq.append(1) dq.append(2) dq.appendleft(3) dq v = dq.pop() v dq.popleft() dq dq = deque(maxlen = 3) for n in range(10): dq.append(n) dq import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] #heapq is created from a list heap = list(nu...
<SYSTEM_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 maxlen to limit the num of items in a deque Step2: 2. Heapq Step3: nlargest / nsmallest wraps creation of a heap for one-time access Ste...
14,155
<ASSISTANT_TASK:> Python Code: from calendar import TextCalendar, HTMLCalendar tc = TextCalendar(firstweekday=6) tc.prmonth(2016, 3) object timedelta tzinfo timezone time date datetime pass import time as _time from datetime import date, time, datetime d1 = date(2016, 3, 29) d2 = date....
<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: datetime 模块解决了绝大部分时间与日期相关的操作问题,其中包含了: Step3: Date Step4: 获得 date 对象之后,可以分别获取年、月、日等属性(strftime也是通用的格式化方法,将在后面介绍): Step5: Time Step6: datetime...
14,156
<ASSISTANT_TASK:> Python Code: from IPython.core.display import HTML css_file = 'pynoddy.css' HTML(open(css_file, "r").read()) import sys, os import matplotlib.pyplot as plt # adjust some settings for matplotlib from matplotlib import rcParams # print rcParams rcParams['font.size'] = 15 # determine path of repository 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: Import in Experiment object Step2: Adjust properties of tilt event Step3: Now, we can define a stochastic variable for the tilt rotation Step4...
14,157
<ASSISTANT_TASK:> Python Code: import pickle from geopy.distance import vincenty station_data = pickle.load( open( "station_data.p", "rb" ) ) bike_location = pickle.load( open( "bike_location.p", "rb" ) ) print(station_data['RD']['Bethesda']) print(bike_location['Silver Spring Metro/Colesville Rd & Wayne Ave']) vinc...
<SYSTEM_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 all data (data was previously cleaning in other notebooks) Step2: Now I have one dict with metro stations and one with bike stations Ste...
14,158
<ASSISTANT_TASK:> Python Code: %matplotlib notebook import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import json import requests import time import pickle from ipywidgets import FloatProgress from IPython.display import display #from API_client.python.datahub import datahub #from API_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: Combine statistics and hard limits Step2: Dump the file for later use Step3: Helper methods to plot the problematic data Step4: Merge all .pi...
14,159
<ASSISTANT_TASK:> Python Code: import os import json import numpy as np import tfx import tensorflow as tf import tensorflow_transform as tft import tensorflow_data_validation as tfdv import tensorflow_model_analysis as tfma from tensorflow_transform.tf_metadata import schema_utils import logging from src.common 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: Setup Google Cloud project Step2: Set configurations Step3: Create Interactive Context Step4: 1. Hyperparameter generation Step5: 2. Data ex...
14,160
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-1', '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...
14,161
<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()) texto = "Cientista de Dados é a profissão que mais tem crescido em todo mundo.\n" texto = texto + "Esses profissionais precisam se especial...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: ** ATENÇÃO **** Step2: Usando a expressão with Step3: Manipulando Arquivos CSV (comma-separated values ) Step4: Manipulando Arquivos JSON (Ja...
14,162
<ASSISTANT_TASK:> Python Code: %matplotlib notebook from numpy import * from scipy.integrate import odeint from matplotlib.pyplot import * ion() def consumer_resource1(y, t, r, K, b1, m1, b2, m2): return array([ y[0] * (r*(1-y[0]/K) - b1*y[1] - b2*y[2]), y[1] * (b1*y[0] - m1), ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <div id="2">2. Coexistência em equilíbrio Step2: <div id="3">3. Não-linearidade relativa</div>
14,163
<ASSISTANT_TASK:> Python Code: # downloading packages: !pip install wget pycroscopy # Ensure python 3 compatibility: from __future__ import division, print_function, absolute_import, unicode_literals # In case some of these packages are not installed, install them #!pip install -U os wget numpy h5py matplotlib pycrosco...
<SYSTEM_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. Select the Raw Data File Step2: 1. Exploring the Raw Data File Step3: 2. Loading the data Step4: 3. Read the parameters Step5: 3.a Prepar...
14,164
<ASSISTANT_TASK:> Python Code: # Import packages %run startup.py bf = Session(host="localhost") def show_first_trace(trace_answer_frame): Prints the first trace in the answer frame. In the presence of multipath routing, Batfish outputs all traces from the source to destination. This function pick...
<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: Analyzing public cloud and hybrid networks Step3: Initializing the Network and Snapshot Step4: The network snapshot that we just initialized i...
14,165
<ASSISTANT_TASK:> Python Code: dest_A_rand_I = [] dest_B_rand_I = [] dest_A_rand_p = [] dest_B_rand_p = [] for i in range(1000): phi = np.random.uniform(0,np.pi*2, 50).reshape((-1,1)) num = np.arange(0,50).reshape((-1,1)) OX = np.random.randint(0,500, 50).reshape((-1,1)) OY = np.random.randint(0,500, 50...
<SYSTEM_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 1000 random datasets of 50 vectors with constrained origins (to induce positive spatial autocorrrlation), then calculate the vector Mor...
14,166
<ASSISTANT_TASK:> Python Code: #Se prepara el entorno de trabajo %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd #matplotlib.style.use('ggplot') se puede correr este código para usar gráficos del tipo de ggplot2 en R plt.rcParams['figure....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Con la muestra de datos que se define en Ingresos_2, la idea es procesarla y explorar los datos. Esto de manera sencilla implica conocer los tip...
14,167
<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: Implementing Custom Aggregations Step2: Design summary Step3: Instead of summing value, the example task is to sum value * 2.0 and then divide...
14,168
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np import os assert os.path.isfile('yearssn.dat') data = np.loadtxt('yearssn.dat') #Creates two arrays, year is the first column of data and ssc is the second column of data year = data[:,0] ssc = data[:,1] print (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: Line plot of sunspot data Step2: Use np.loadtxt to read the data into a NumPy array called data. Then create two new 1d NumPy arrays named year...
14,169
<ASSISTANT_TASK:> Python Code: # Copyright 2022 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
<SYSTEM_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: Load ImageNet dataset Step3: Define a set of evaluation metrics Step4: Load pre-trained Epinet Step5: From the checkpoint, we...
14,170
<ASSISTANT_TASK:> Python Code: # gym オープンソースライブラリの読み込み import gym # 環境を作る env = gym.make('CartPole-v0') # 'CartPole-v0' は環境ID #env = gym.make('MountainCar-v0') # 'MountainCar-v0'という別の環境 #env = gym.make('MsPacman-v0') # 'MsPacman-v0'という別の環境 env.seed(42) # 環境の初期化(最初の観測が得られる) env.reset() # 描画 env.render() # 行動選択(...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step 1 Step1: Step 2 Step2: Step 3 Step3: 観測 Step4: 空間 Step5: Descrete Step6: Box Step7: スペースからサンプリングすることも、ある値がスペースに含まれているか調べることもできる。 Step8: 環境 ...
14,171
<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...
14,172
<ASSISTANT_TASK:> Python Code: MovieTextFile = open("tmdb_5000_movies.csv") # for line in MovieTextFile: # print(line) # not quite right # type(MovieTextFile) import csv with open("tmdb_5000_movies.csv",encoding="utf8") as f: reader = csv.reader(f) MovieList = list(reader) MovieList[:5] import pandas as pd...
<SYSTEM_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 as a list of lines Step2: Import data as a data frame Step3: Goal 2 Step4: Goal 3
14,173
<ASSISTANT_TASK:> Python Code: # Setup your dependencies import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLO...
<SYSTEM_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 and define constants Step2: Tutorial Step3: Create the study configuration Step4: Create the study Step7: Metric evaluation...
14,174
<ASSISTANT_TASK:> Python Code: !pip install -I "phoebe>=2.1,<2.2" %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.set_value('sma@binary', 20) b.set_value('q', 0.8) b.set_value('ecc', 0.8) b.set_valu...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: As always, let's do imports and initialize a logger and a new Bundle. See Building a System for more details. Step2: And let's make our system...
14,175
<ASSISTANT_TASK:> Python Code: #Import data from json file and create a list data = [] with open('/home/borjaregueral/Digital_Music_5.json') as f: for line in f: data.append(json.loads(line)) #Create a dataframe with the columns that are interesting for this exercise #Columns left out: 'helpful', 'reviewTim...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Build Sentiment Scores and Categories Step2: Bag of Words Step3: Bernoulli Step4: Logistic Model Step5: TFIDF Step6: Logistic Model Step7: ...
14,176
<ASSISTANT_TASK:> Python Code: import graphlab import matplotlib.pyplot as plt import numpy as np %matplotlib inline '''Check GraphLab Create version''' from distutils.version import StrictVersion assert (StrictVersion(graphlab.version) >= StrictVersion('1.8.5')), 'GraphLab Create must be version 1.8.5 or later.' wiki...
<SYSTEM_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 Wikipedia dataset Step2: Extract word count vectors Step3: Find nearest neighbors Step4: Let's look at the top 10 nearest neighbors by p...
14,177
<ASSISTANT_TASK:> Python Code: # If you'd like to download it through the command line... !curl -O http://www.cs.cornell.edu/home/llee/data/convote/convote_v1.1.tar.gz # And then extract it through the command line... !tar -zxf convote_v1.1.tar.gz # glob finds files matching a certain filename pattern import glob # Gi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: You can explore the files if you'd like, but we're going to get the ones from convote_v1.1/data_stage_one/development_set/. It's a bunch of text...
14,178
<ASSISTANT_TASK:> Python Code: %matplotlib inline %pylab inline from __future__ import print_function import matplotlib.pyplot as plt import matplotlib.animation as animation import theano import numpy as np from theano import tensor as T from numpy.linalg import inv x = 2 print(x) y = x**2 print(y) # Theano symbolic...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Testing variable assignment and operations in python Step2: Extra Step3: Simple Linear Regression Step5: From linear regression using the mod...
14,179
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-esm2-hr5', 'ocean') # 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...
14,180
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 !pip install qq-training-wheels auquan_toolbox --upgrade from qq_training_wheels.momentum_trading import MomentumTradingParams from backtester.trading_system import TradingSystem from backtester.features.feature import Feature import numpy as np class ...
<SYSTEM_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 import everything we need to run our backtesting algorithm Step2: The class below implements all the logic you need to run the momentum b...
14,181
<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...
14,182
<ASSISTANT_TASK:> Python Code: %matplotlib inline from __future__ import division from matplotlib import pyplot as plt import numpy as np import pymc3 as pm import scipy as sp import seaborn as sns from statsmodels.datasets import get_rdataset from theano import tensor as tt blue, *_ = sns.color_palette() SEED = 513229...
<SYSTEM_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 draw and plot samples from the stick-breaking process. Step2: As stated above, as $\alpha \to \infty$, samples from the Dirichlet process co...
14,183
<ASSISTANT_TASK:> Python Code: OSMFILE = 'dataset/jakarta.osm' %%writefile 02-codes/audit.py import xml.etree.cElementTree as ET from collections import defaultdict import re import pprint from optparse import OptionParser # OSMFILE = "sample.osm" # OSMFILE = "example_audit.osm" #In Indonesia, type first, then name. 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: Step5: To audit the osm file, first we need to know the overview of the data. Step7: This will save the jakarta osm that has been audited into jakarta...
14,184
<ASSISTANT_TASK:> Python Code: #Import libraries import matplotlib.pyplot as plt import mdtraj as md import glob import numpy as np from msmbuilder.dataset import dataset %pylab inline #Import longest trajectory. t = md.load("run0-clone138.h5") frame = np.arange(len(t))[:, np.newaxis] # Using 0.25 so that units are in...
<SYSTEM_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 timestep for these simulations is 2 fs (can be found in /data/choderalab/fah/initial-models/projects/ABL1_HUMAN_D0_V1/RUN0/integrator.xml [s...
14,185
<ASSISTANT_TASK:> Python Code: # As usual, a bit of setup from __future__ import print_function 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_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Dropout Step2: Dropout forward pass Step3: Dropout backward pass Step4: Fully-connected nets with Dropout Step5: Regularization experiment
14,186
<ASSISTANT_TASK:> Python Code: import tensorflow as tf #import tensorflow.contrib.learn.python.learn as learn import tflearn import scipy as sp import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from random import shuffle, randint from sklearn.utils import shuffle as mutualShuf...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step9: Import and process data Step10: Neural Network Step11: Test accuracy of model(s) Step12: What if the model hasn't seen data from the patient?...
14,187
<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...
14,188
<ASSISTANT_TASK:> Python Code: import ray import ray.rllib.agents.ppo as ppo from ray import serve def train_ppo_model(): trainer = ppo.PPOTrainer( config={"framework": "torch", "num_workers": 0}, env="CartPole-v0", ) # Train for one iteration trainer.train() trainer.save("/tmp/rllib...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Hiding and removing cells Step2:
14,189
<ASSISTANT_TASK:> Python Code: df.head() hm = HeatMap(df, x=bins('mpg'), y=bins('displ')) show(hm) hm = HeatMap(df, x=bins('mpg'), y=bins('displ'), values='cyl', stat='mean') show(hm) hm = HeatMap(df, x=bins('mpg'), y=bins('displ', bin_count=15), values='cyl', stat='mean') show(hm) hm = HeatMap(df, 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 Binning Step2: Binning and Aggregating Values Step3: Specifying the Number of Bins Step4: Mixing binning and non-binned data Step5: The S...
14,190
<ASSISTANT_TASK:> Python Code: import numpy as np from scipy.stats import kurtosis, skew import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sb import sqlite3 %matplotlib inline plt.rcParams['figure.figsize'] = (8,6) plt.rc('axes', titlesize=18) plt.rc('axes', labelsize=15) 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: Reading the Metadata SQL table Step2: Exploring the Metadata tables Step3: There are no missing values but that does not mean there are not an...
14,191
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np from pandas import DataFrame,read_csv #Emplacement des compteurs avec la correspondance pour les noms dans les fichiers de comptage. #http://donnees.ville.montreal.qc.ca/dataset/f170fecc-18db-44bc-b4fe-5b0b6d2c7297/resource/c7d0546a-a218-479e-bc9f-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: 2. Charger des données Step2: 2.1 Charger des colonnes spécifiques Step3: 2.2 Charger une colonne en index Step4: Dans cet exemple, en charga...
14,192
<ASSISTANT_TASK:> Python Code: # Useful Functions def find_cointegrated_pairs(data): n = data.shape[1] score_matrix = np.zeros((n, n)) pvalue_matrix = np.ones((n, n)) keys = data.keys() pairs = [] for i in range(n): for j in range(i+1, n): S1 = data[keys[i]] S2 = ...
<SYSTEM_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. Cointegration Test II Step3: Exercise 2 Step4: b. Real Cointegration Test II Step5: Exercise 3 Step6: b. Testing the C...
14,193
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.style.use('fivethirtyeight') plt.rcParams['figure.figsize'] = (10, 6) x = np.arange(-10, 10, 1) y1 = (15 - x)/3 y2 = (2 - 2*x)/-1 plt.plot(x, y1) plt.text(x[-1], y1[-1], 'row1') plt.plot(x, y2) plt.text(x[-1], y2[-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: Column-wise / Vectors (2x2) Step2: Now we know the answer to this is a linear combination of the two vectors. So we multiply the first vector ...
14,194
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from math import sqrt import pprint import matplotlib.pyplot as plt import seaborn as sns from sklea...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Importing the required datasets Step2: Cleaning and preparing the datasets Step3: Randomly splitting the dataset into training and testing set...
14,195
<ASSISTANT_TASK:> Python Code: from googlefinance import getQuotes import time import json import os import sys from IPython.display import clear_output def buscar_accion(nombre_accion): clear_output() os.system('cls' if os.name=='nt' else 'clear') print(json.dumps(getQuotes(nombre_accion), indent=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: Paso 2 Step2: Paso 3
14,196
<ASSISTANT_TASK:> Python Code: from classy import * data=load_excel('data/iris.xls',verbose=True) print(data.vectors.shape) print(data.targets) print(data.target_names) print(data.feature_names) subset=extract_features(data,[0,2]) plot2D(subset,legend_location='upper left') C=SVM() data_train,data_test=split(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: Load the Data Step2: Look at the data Step3: since you can't plot 4 dimensions, try plotting some 2D subsets Step4: I don't want to do the cl...
14,197
<ASSISTANT_TASK:> Python Code: import venusar import motif import thresholds import motifs import activity import tf_expression import gene_expression # to get code changes import imp imp.reload(motif) motif_f_base='../../data/HOCOMOCOv10.JASPAR_FORMAT.TF_IDS.txt' pc = 0.1 th = 0 bp = [0.25, 0.25, 0.25, 0.25] moti...
<SYSTEM_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 Motif Definitions Step2: Convert to DataFrame for Analysis of Duplication Step3: Move On
14,198
<ASSISTANT_TASK:> Python Code: print('Number of apps in the dataset : ' , len(df)) df.sample(7) # - Installs : Remove + and , df['Installs'] = df['Installs'].apply(lambda x: x.replace('+', '') if '+' in str(x) else x) df['Installs'] = df['Installs'].apply(lambda x: x.replace(',', '') if ',' in str(x) else x) df['Insta...
<SYSTEM_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 Cleaning Step2: Basic EDA Step3: This is the basic exploratory analysis to look for any evident patterns or relationships between the fea...
14,199
<ASSISTANT_TASK:> Python Code: import pandas as pd import matplotlib.pyplot as plt import numpy as np import requests import re plt.style.use('ggplot') import matplotlib %matplotlib inline # Download the data file from `puu.sh` and save it locally under `file_name`: url = "http://puu.sh/oBCfW/c006093339.xlsx" # Script...
<SYSTEM_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 Dataset Step2: Cleaning Data Step3: Calculating New Parameters Step4: a = {} Step5: Notice the lack of IPOs following the popping of...