Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
8,100
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.display import Image from IPython.html.widgets import interact, interactive, fixed Image('fermidist.png') def fermidist(energy, mu, kT): Compute the Fermi distribution at energy, mu and kT. 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: Step1: Exploring the Fermi distribution Step3: In this equation Step4: Write a function plot_fermidist(mu, kT) that plots the Fermi distribution $F(\...
8,101
<ASSISTANT_TASK:> Python Code: class ListNode: def __init__(self, data): self.data = data a = ListNode(11) b = ListNode(52) c = ListNode(18) print(a) class ListNode: def __init__(self, data): self.data = data self.next = None # Initial creation of nodes a = ListNode(11) b = ListNode(52...
<SYSTEM_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 will give us just the containers that we can store data into. Step2: Since we did not define a method to show the value stored, we cann...
8,102
<ASSISTANT_TASK:> Python Code: from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, Variable, Field from glob import glob import numpy as np import xarray as xr from datetime import timedelta as delta import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt from matplotlib.colors import 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: 1. A grids Step2: Figure 1 shows how land grid points and boundaries can be interpreted, depending on whether you assume a grid node is at the ...
8,103
<ASSISTANT_TASK:> Python Code: import cartopy.crs as ccrs import cartopy.feature as cfeature from matplotlib.colors import BoundaryNorm import matplotlib.pyplot as plt import numpy as np from metpy.cbook import get_test_data from metpy.interpolate import (interpolate_to_grid, remove_nan_observations, ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Point Interpolation Step2: Scipy.interpolate linear Step3: Natural neighbor interpolation (MetPy implementation) Step4: Cressman interpolatio...
8,104
<ASSISTANT_TASK:> Python Code: from __future__ import print_function %matplotlib inline import time import numpy as np from landlab import RasterModelGrid as rmg from landlab import load_params from Ecohyd_functions_flat import ( Initialize_, Empty_arrays, Create_PET_lookup, Save_, Plot_, ) grid1 =...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Note Step2: Include the input file that contains all input parameters needed for all components. This file can either be a python dictionary or...
8,105
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib import os import scipy as sp import matplotlib.pyplot as plt from GeoData.GeoData import GeoData from GeoData.utilityfuncs import readMad_hdf5 from GeoData.plotting import rangevsparam, rangevstime madfile = os.path.join( 'pfa140105.004.hdf5') data1 =...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Read in Data Step2: Range Time Plots Step3: Range vs Parameter Plots
8,106
<ASSISTANT_TASK:> Python Code: baseURL = "http://localhost:8000" client = ga4gh.client.HttpClient(baseURL) referenceSets = list(client.searchReferenceSets()) print("ReferenceSets") for referenceSet in referenceSets: print("NCBI Taxon Id: {}".format(referenceSet.ncbiTaxonId)) referenceSet = client.getReferenceSet(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: Great! Now we can run calls to query ReferenceSets, References, Datasets, VariantSets, CallSets, Variants, ReadGroups, ReadGroupSets, & Reads. ...
8,107
<ASSISTANT_TASK:> Python Code: import retina.core.axes import matplotlib.pyplot as plt import numpy as np %matplotlib inline fig = plt.figure() ax1 = plt.subplot('111', projection='Fovea2D') plt.xlabel('x') plt.ylabel('y') plt.title('An Introduction to Retina') x = np.linspace(-2 * np.pi, 2 * np.pi) sin_y = np.sin(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: Let's set up our plot so as to make it look more professional. Step2: Not too shabby. I find it annoying that the label for the y-axis is tilte...
8,108
<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_write':'service', # Credentials used for 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: 2. Set Configuration Step2: 3. Enter DV360 SDF To BigQuery Recipe Parameters Step3: 4. Execute DV360 SDF To BigQuery
8,109
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime import os plt.style.use('ggplot') get_ipython().magic('pylab inline') import nltk from nltk.tokenize import word_tokenize import re from collections import Counter from nltk.corpus 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: 1. Numero Dataset PA Step2: 2. Numero Dataset PA senza Metadati Step3: 3. Group by Catalogo Padre Step4: 4. Group by Gruppo Step5: Group by ...
8,110
<ASSISTANT_TASK:> Python Code: from __future__ import division import sympy from sympy import * from sympy import Rational as frac import simpletensors from simpletensors import Vector, TensorProduct, SymmetricTensorProduct, Tensor init_printing() var('vartheta, varphi') var('nu, m, delta, c, t') # These are related sc...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Examples and tests Step2: Sympy can be a little tricky because it caches things, which means that the first implementation of this code silentl...
8,111
<ASSISTANT_TASK:> Python Code: # Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op import mne data_path = mne.datasets.sample.data_path() raw_erm = mne.io.read_raw_fif(op.join(data_path, 'MEG', 'sample', 'ernoise_raw.fif'), preload=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: We can plot the absolute noise levels
8,112
<ASSISTANT_TASK:> Python Code: %pylab notebook Sbase = 5000e3 # [VA] Vp0 = 230e3 # [V] Vs0 = 13.8e3 # [V] Req_pu = 0.01 Xeq_pu = 0.05 Voc = 13.8e3 # [V] Ioc = 21.1 # [A] Poc = 90.8e3 # [W] yex = Ioc / Voc print('yex = {:.6f}'.format(yex)) theta = arccos(Poc/(Voc*Ioc)) print('theta = {:.2f}°'.format(the...
<SYSTEM_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: The open-circuit test performed on the low-voltage side of the transformer yielded the following data Step3: (a) Step4: $\...
8,113
<ASSISTANT_TASK:> Python Code: 6 * 2 a = 6 b = 2 a * b print a print b print a * b print a / b print 'the value of a is', a a**b print '1/3 gives', 1 / 3 print '1.0 / 3 gives', 1.0 / 3 print '1 / 3.0 gives', 1 / 3.0 print '1.0 / 3.0 gives', 1.0 / 3.0 print 'a:', a import matplotlib.pyplot as plt %matplotlib inl...
<SYSTEM_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 the extra space to make the code more (visually) readable. Step2: Both a and b are now VARIABLES. Each variable has a type. In thi...
8,114
<ASSISTANT_TASK:> Python Code: import random import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.transforms as transforms device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") class Net(nn.Module):...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Recall that a basic neural network in PyTorch can be set up like this Step2: We load CIFAR-10 dataset and reshape them as individual vectors. T...
8,115
<ASSISTANT_TASK:> Python Code: #A variable stores a piece of data and gives it a name #syntax of the form: #variable_name = variable_value #What are some types of variables you will need to use? answer = 42 print(answer) is_it_tuesday = True is_it_wednesday = False print(is_it_tuesday) pi_approx = 3.1415 print(pi_appro...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: More Complicated Data Types Step2: Basic Things to do with Variables. Especially Floats. Step3: Conditionals in Python Step4: Functions in Py...
8,116
<ASSISTANT_TASK:> Python Code: from IPython.display import display from sympy import init_printing, latex init_printing() from sympy.printing import StrPrinter StrPrinter._print_Quantity = lambda self, expr: str(expr.abbrev) # displays short units (m instead of meter) %run -i 'test_equation_definitions.py' for eq ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Numerical evaluations Step3: Substitution of equations and values into equations Step4: We can substitute a range of equations into each other...
8,117
<ASSISTANT_TASK:> Python Code: # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne import io from mne.stats import permutation_cluster_test from mne.datasets import sample print(__doc__) data_path = sample.data_path() meg_path = 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: Set parameters Step2: Read epochs for the channel of interest Step3: Compute statistic Step4: Plot
8,118
<ASSISTANT_TASK:> Python Code: import functools from datetime import datetime def timer(func): @functools.wraps(func) def timed_func(*args, **kwargs): start = datetime.now() ret = func(*args, **kwargs) tm = datetime.now() - start print("Running time: {}".format(tm.total_seconds()...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: HTML tag adder. Step2: Arbitrary tag adder. Step3: Check if all parameters (keyword too) are of a given type. Step4: Write a decorator that m...
8,119
<ASSISTANT_TASK:> Python Code: filename_brahms = 'brahms_hungarian_dance_5.mp3' url = "http://audio.musicinformationretrieval.com/" + filename_brahms if not os.path.exists(filename_brahms): urllib.urlretrieve(url, filename=filename_brahms) librosa.load? x_brahms, fs_brahms = librosa.load(filename_brahms, duration=...
<SYSTEM_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 120 seconds of an audio file Step2: Plot the time-domain waveform of the audio signal Step3: Play the audio file Step4: Step 2 Step5: W...
8,120
<ASSISTANT_TASK:> Python Code: !wget http://blpd0.ssl.berkeley.edu/Voyager_data/Voyager1.single_coarse.fine_res.h5 %matplotlib inline import pylab as plt from blimpy import Waterfall file_path = 'Voyager1.single_coarse.fine_res.h5' obs = Waterfall(file_path) obs.info() print(obs.header) print(obs.data.shape) obs.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: Firstly, let's setup the notebook and import the Waterfall() class to read the data. Step2: Now, let's read the observation data using Waterfal...
8,121
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from qutip import * def integrate(N, h, Jx, Jy, Jz, psi0, tlist, gamma, solver): si = qeye(2) sx = sigmax() sy = sigmay() sz = sigmaz() sx_list = [] sy_list = [] sz_list = [] for n in ra...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Hamiltonian Step2: Software version
8,122
<ASSISTANT_TASK:> Python Code: import argparse import datetime from dateutil import parser as date_parser import json import logging import numpy as np import os import pandas as pd import pprint import requests from pandas.io.json import json_normalize query_template={{ search(query: "org:kubeflow is:pr is:open cre...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Background Step2: Distribution of PRs' open time (age) Step3: PRs which need attention Step4: PRs which need authors' attentions Step5: PRs ...
8,123
<ASSISTANT_TASK:> Python Code: # Import modules import sys import numpy as np import matplotlib.pyplot as plt # Import PySwarms import pyswarms as ps print('Running on Python version: {}'.format(sys.version)) def cost_function(I): #Fixed parameters U = 10 R = 100 I_s = 9.4e-12 v_t = 25.85e-3 ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Defining the cost fuction Step2: Setting the optimizer Step3: Checking the solution Step4: Another way of solving non-linear equations is by ...
8,124
<ASSISTANT_TASK:> Python Code: ### FIRST SOME CODE #### from __future__ import division, print_function, absolute_import from IPython.display import SVG, display, Image, HTML import numpy as np, scipy as sp, pylab as pl, matplotlib.pyplot as plt, scipy.stats as stats, sklearn, sklearn.datasets from scipy.spatial.distan...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Gaussian Processes Step2: Support Vector Machines Step3: Feature engineering and two classification algorithms Step4: Working in Feature Spac...
8,125
<ASSISTANT_TASK:> Python Code: class Edge : def __init__(self ) : self . src = 0 self . dest = 0 self . weight = 0   class Graph : def __init__(self ) : self . V = 0 self . E = 0 self . edge =[]   def createGraph(V , E ) : graph = Graph() ; graph . V = V ; graph . E = E ; graph . ed...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
8,126
<ASSISTANT_TASK:> Python Code: import numpy as np x = np.array([-2, -1.4, -1.1, 0, 1.2, 2.2, 3.1, 4.4, 8.3, 9.9, 10, 14, 16.2]) result = x[x >=0] <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:
8,127
<ASSISTANT_TASK:> Python Code: cylinder_app() plot_layer_potentials_app() MidpointPseudoSectionWidget() DC2DPseudoWidget() DC2DfwdWidget() <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: 2. Potential differences and Apparent Resistivities Step2: 3. Building Pseudosections Step3: DC pseudo-section app Step4: 4. Parametric Inver...
8,128
<ASSISTANT_TASK:> Python Code: import numpy as np import pymc as mc H = mc.Normal('H', 2.00, (0.03)**-2) h = mc.Normal('h', 0.88, (0.04)**-2) @mc.deterministic() def Q(H=H, h=h): return H-h model = mc.MCMC((H,h,Q)) model.sample(1e4, burn=100, burn_till_tuned=True) # mc.Matplot.plot(model) # mc.Matplot.plot(Q) 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: Example 2 Step2: Example 3 Step3: Example 4 Step4: Example 5 Step5: Example 6 Step6: Example 7
8,129
<ASSISTANT_TASK:> Python Code: class Person: ##SCOPE OF CLASS DOWN BELOW institute="IIT" def __init__(self,name,department): self.name=name self.department=department def getName(self): return self.name p=Person("mangesh","physics") p.getName() help(map) store1=[10,12,8,3,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: MAP FUCNTION Step2: We get lazy evaluation here and so map is not computed here so we get just the map object back Step3: Lambda Step4: Exam...
8,130
<ASSISTANT_TASK:> Python Code: ls # Load Biospytial modules and etc. %matplotlib inline import sys sys.path.append('/apps/external_plugins/spystats/spystats/') sys.path.append('..') import django django.setup() import pandas as pd import matplotlib.pyplot as plt import numpy as np ## Use the ggplot style plt.style.use(...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Use this to automate the process. Be carefull it can overwrite current results Step2: Now we will obtain the data from the calculated empirical...
8,131
<ASSISTANT_TASK:> Python Code: import requests from lxml import html %%HTML <html> <body> <h1>Favorite Python Librarires</h1> <ul> <li>Numpy</li> <li>Pandas</li> <li>requests</li> </ul> </body> </html> html_code = In[2] html_code = html_code[42:-2].replace("\\n","\n") print(html_code)...
<SYSTEM_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 HTML Code Step2: Using xpath to find nodes in a document Step3: To read the text inside that tag you can use the text variable. Step4: A...
8,132
<ASSISTANT_TASK:> Python Code: from eden.util import load_target y = load_target( 'http://www.bioinf.uni-freiburg.de/~costa/bursi.target' ) from eden.converter.graph.gspan import gspan_to_eden graphs = gspan_to_eden( 'http://www.bioinf.uni-freiburg.de/~costa/bursi.gspan' ) from eden.graph import Vectorizer vectorizer...
<SYSTEM_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 and convert it to graphs Step2: 2 Vectorization Step3: extract features and build data matrix Step4: 3 Modelling
8,133
<ASSISTANT_TASK:> Python Code: net = clstm.make_net_init("lstm1","ninput=1:nhidden=4:noutput=2") print net net.setLearningRate(1e-4,0.9) print clstm.network_info(net) print net.sub.size() print net.sub[0] print net.sub[0].name N = 20 xs = array(randn(N,1,1)<0.2, 'f') net.inputs.aset(xs) net.forward() N = 20 test = a...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: You can navigate the network structure as you would in C++. You can use similar methods to create more complex network architectures than possib...
8,134
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csir-csiro', 'vresm-1-0', 'seaice') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name"...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 2...
8,135
<ASSISTANT_TASK:> Python Code: from IPython.display import display from sympy import init_printing from sympy import symbols, as_finite_diff, solve, latex from sympy import Function, Eq fg, f0, f1, f2 = symbols('f_g, f_0, f_1, f_2') z, h = symbols('z, h') a, b = symbols('a, b') f = Function('f') init_printing() extraP...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Extrapolation of $f(0) = a$ to the ghost point yields (see ghost4thOrder for calculation) yields Step2: Which can be rewritten to Step3: Furth...
8,136
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as colors from mpl_toolkits.axes_grid1 import make_axes_locatable from pandas import set_option set_option("display.max_rows", 10) pd.options.mode.ch...
<SYSTEM_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 data is from the Council Grove gas reservoir in Southwest Kansas. The Panoma Council Grove Field is predominantly a carbonate gas reservoi...
8,137
<ASSISTANT_TASK:> Python Code: # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.inverse_sparse import gamma_map, make_stc_from_dipoles from mne.viz 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: Plot dipole activations Step2: Show the evoked response and the residual for gradiometers Step3: Generate stc from dipoles Step4: View in 2D ...
8,138
<ASSISTANT_TASK:> Python Code: # Location of digested data input_directory = '/digested/' # Location of saved trained model model_directory = '/model_directory/' # Desired location for outputs output_directory = '/output_directory/' %matplotlib inline import keras import pickle from keras.layers import * from keras.mo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: ------------- (semi)-Automatic ------------- Step2: Configure GPU/CPU devices Step3: Data queueing Step4: Load data Step5: Load trained mode...
8,139
<ASSISTANT_TASK:> Python Code: %run ../graph/graph.py def bfs(root, visit_func): # TODO: Implement me pass %run ../utils/results.py # %load test_bfs.py from nose.tools import assert_equal class TestBfs(object): def __init__(self): self.results = Results() def test_bfs(self): nodes = [] ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Unit Test
8,140
<ASSISTANT_TASK:> Python Code: # a szokásos rutinok betöltése %pylab inline from scipy.integrate import * # az integráló rutinok betöltése def f(x): return (x**2+3*x+2) quad(f,-1,1) # az integrandus definiálása def gauss(x): return exp(-x**2) quad(gauss,-inf,inf) sqrt(pi) def h(x): return ((x-1.0)**(-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: Vizsgáljuk meg az alábbi egyszerű integrált $$ \int_{-1}^1 (x^2+3x +2)\mathrm{d}x .$$ Step2: Most már meghívhatjuk a quad-ot. Az első változó ...
8,141
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np import skrf as rf rf.stylely() Pin = 400 # W z0 = 50 # Ohm freq = rf.Frequency(13.56, npoints=1, unit='MHz') VF = 0.84 RL = 50 # Ohm L = 20 # m alpha = rf.db_2_np(1.483/100) # Np/m beta = freq.w/rf.c/VF gamma = al...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Let's define the problem constants Step2: The propagation constant of the transmission line $\gamma=\alpha+j\beta$ is Step3: The matched line ...
8,142
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib import matplotlib.cm as cm import numpy as np import matplotlib.pyplot as plt import jinja2, json, sys from math import log, fabs, pi, cos, sin from scipy.stats import ks_2samp try: try: import ruamel.yaml as yaml except ImportError: ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Run simulation Step2: Plot sampled histogram against expected result Step3: Statistical test of output against expected result
8,143
<ASSISTANT_TASK:> Python Code: %matplotlib inline import time import pandas import random import numpy import matplotlib.pyplot as plt import seaborn; seaborn.set_style('whitegrid') import itertools from pomegranate import * random.seed(0) numpy.random.seed(0) numpy.set_printoptions(suppress=True) %load_ext watermark %...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Building a new normal distribution Step2: The custom objects have a few requirements. Step3: Looks good so far. Looks like there might be a sm...
8,144
<ASSISTANT_TASK:> Python Code: import socket print(socket.gethostname()) import socket HOSTS = [ 'apu', 'pymotw.com', 'www.python.org', 'nosuchname', ] for host in HOSTS: try: print('{} : {}'.format(host, socket.gethostbyname(host))) except socket.error as msg: 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: Use gethostbyname() to consult the operating system hostname resolution API and convert the name of a server to its numerical address. Step2: F...
8,145
<ASSISTANT_TASK:> Python Code: git clone https://github.com/sungeunbae/python-files.git cd python-files !ls import numpy numpy.loadtxt(fname='inflammation-01.csv', delimiter=',') weight_kg = 55 print weight_kg print 'weight in pounds:', 2.2 * weight_kg weight_kg = 57 weight_lb = 2.2*weight_kg print 'weight in kilog...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Enter "ipython notebook" to get started Step2: We import other modules to utilize other people's work. numpy enables to do fancy things with nu...
8,146
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.tsa.stattools import coint, adfuller import matplotlib.pyplot as plt from quantopian.research.experimental import continuous_future, history soy_meal_mult = symbols('SMF17').multiplier soy_oil_mult = 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: Pairs of Futures (or Spreads) Step2: However, from looking at the p-value for our test, we conclude that soybean meal and soybean meal and soyb...
8,147
<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 Step7: Implement Preprocessing Function Step9: Preprocess all the data and save it Step11: Chec...
8,148
<ASSISTANT_TASK:> Python Code: import random, math import pandas as pd import numpy as np import scipy.io from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt matplotlib.style.use('ggplot') # Look Pretty # Leave this alone until indicated: Test_PCA = False def plotDecisionBoundary(model, X, y): ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: A Convenience Function Step2: The Assignment Step3: Copy out the status column into a slice, then drop it from the main dataframe. Always veri...
8,149
<ASSISTANT_TASK:> Python Code: from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data", one_hot=True) import tensorflow as tf x = tf.placeholder(tf.float32, [None, 784]) x W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matm...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Softmax Regressions Step2: We describe these interacting operations by manipulating symbolic variables. Let's create one Step3: $\mathrm{x}$ i...
8,150
<ASSISTANT_TASK:> Python Code: # http://www.glozman.com/textpages.html # Harry Potter 1 - Sorcerer's Stone.txt # Harry Potter 2 - Chamber of Secrets.txt # Harry Potter 3 - The Prisoner Of Azkaban.txt # Harry Potter 4 - The Goblet Of Fire.txt # Harry Potter 5 - Order of the Phoenix.txt # Harry Potter 6 - The Half 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: Create the Training set Step2: One-hot encode Step3: Create the Model Step4: Train the Model Step5: Generate new sequence
8,151
<ASSISTANT_TASK:> Python Code: cd .. import sys import os sys.path.append(os.path.abspath('./faiss/')) sys.path.append(os.path.abspath('./python/')) from experiments.data import get_data from misc.utils import to_ft, load_sift X, Y, words_mask, labels_mask = get_data('./data/LSHTC', 'train', min_words=3, min_labels...
<SYSTEM_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: Add these directories to PYTHONPATH so that we can import them Step3: Import our functions to read Extreme-Repository data format ...
8,152
<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...
8,153
<ASSISTANT_TASK:> Python Code: # Render our plots inline %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np import os pd.set_option('display.mpl_style', 'default') # Make the graphs a bit prettier plt.rcParams['figure.figsize'] = (16, 6) # adjust to your local directories embem_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: Compare the fraction of emotional sentences per text Step2: Compare the number of lines per text Step3: Compare the average number of labels p...
8,154
<ASSISTANT_TASK:> Python Code: import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.keras import layers from tensorflow.keras.datasets import mnist from tensorflow.keras.models import Model def preprocess(array): Normalizes the supplied array and reshapes it into the appro...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step3: Convolutional autoencoder for image denoising Step4: Prepare the data Step5: Build the autoencoder Step6: Now we can train our autoencoder us...
8,155
<ASSISTANT_TASK:> Python Code: MOD = 1000000007 ; def rangeSum(l , r ) : a = 1 ; b = 9 ; res = 0 ; for i in range(1 , 11 ) : L = max(l , a ) ; R = min(r , b ) ; if(L <= R ) : sum =(L + R ) *(R - L + 1 ) // 2 ; res +=(i * i ) *(sum % MOD ) ; res %= MOD ;  a *= 10 ; b = b * 10 + 9 ;  return 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:
8,156
<ASSISTANT_TASK:> Python Code: #%matplotlib inline ## The usual packages (numpy, matplotlib, etc) import matplotlib.pyplot as plt import numpy as np # nicer figures using ggg plot style. plt.style.use('ggplot') from IPython.core.display import HTML from IPython.display import clear_output from IPython.core.pylabtools 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: Most important step, import all tools in the L2_tools.py file Step2: Download data first Step3: Now read in the data, two dictionaries for OCO...
8,157
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import pandas as pd import copy from IPython.display import HTML import sqlite3 as db import networkx as nx import collections con = db.connect('C:/Users/cliff/workspace/rushHour/Data Model and SQL/Schema Definition and Bulk Load/rush_hour.db') c = con.cursor(...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step3: Function to take connected component id as input and update all states in that component by setting the solution depth and the optimal neighbor ...
8,158
<ASSISTANT_TASK:> Python Code: import gzip import cPickle as pickle with gzip.open("../data/train.pklz", "rb") as train_file: train_set = pickle.load(train_file) with gzip.open("../data/test.pklz", "rb") as test_file: test_set = pickle.load(test_file) with gzip.open("../data/questions.pklz", "rb") as questions_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: What they have? Step5: Step2 Step6: Look at the feature vector. Step8: Step3 Step9: Step4 Step10: Testing model(Prediction) Step11: Step5
8,159
<ASSISTANT_TASK:> Python Code: print (42) x = 42 print (x) x_float = float(42) x_scientific = 42e0 x_str = '42' print ('42 as a float', x_float) print ('42 as a float in scientific notation', x_scientific) print ('42 as a string', x_str) x_list = [x, x_str, x_float, x_scientific] print ("All 42 in a list:", x_list) ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We can store it in a variable and print it out. It doesn't sound confusing at all! Step2: Here, a variable x stores number 42 as an integer. Ho...
8,160
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np raw_data = {'first_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 'pre_score': [4, 24, 31, 2, 3], 'mid_score': [25, 94, 57, 62, 70], 'post_score': [5, 43, 23, 23, 51]} df ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Create dataframe Step2: Make plot
8,161
<ASSISTANT_TASK:> Python Code: !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns %matplotlib inline # TODO 1: Read in the advertising.csv file and set it to a data frame called ad_data. ad_data = 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: Load the Dataset Step2: Check the head of ad_data Step3: Use info and describe() on ad_data Step4: Let's check for any null values. Step5: E...
8,162
<ASSISTANT_TASK:> Python Code: import holoviews as hv import numpy as np hv.notebook_extension() def sine(x, phase=0, freq=100): return np.sin((freq * x + phase)) phases = np.linspace(0,2*np.pi,11) # Explored phases freqs = np.linspace(50,150,5) # Explored frequencies dist = np.linspace(-0.5,0.5,202) # Li...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: A simple function Step2: We will examine the effect of varying phase and frequency Step3: Over a specific spatial area, sampled on a grid Step...
8,163
<ASSISTANT_TASK:> Python Code: import sys print sys.version x = [10, 20, 30, 40, 50] for item in x: print "Item is... you guessed it! ", item !pip install BeautifulSoup seaborn pyquery #IPython is what you are using now to run the notebook import IPython print "IPython version: %6.6s (need at least 3.0.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: Problem Step2: Python Libraries Step3: If you've successfully completed the above install, all of the following statements should run. Step4: ...
8,164
<ASSISTANT_TASK:> Python Code: %pylab inline %load_ext memory_profiler from pomegranate import BayesianNetwork import seaborn, time seaborn.set_style('whitegrid') X = numpy.random.randint(2, size=(2000, 7)) X[:,3] = X[:,1] X[:,6] = X[:,1] X[:,0] = X[:,2] X[:,4] = X[:,5] model = BayesianNetwork.from_samples(X, algorithm...
<SYSTEM_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 structure attribute returns a tuple of tuples, where each inner tuple corresponds to that node in the graph (and the column of data learned ...
8,165
<ASSISTANT_TASK:> Python Code: !pip install ott-jax from IPython import display import jax from jax import numpy as jnp from jax import random import numpy as np from matplotlib import animation from matplotlib import cm import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import ott from ott.core 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: Matching between spaces with different dimensions Step2: We then run OTT's Gromov-Wasserstein solver to find a matching between the points of e...
8,166
<ASSISTANT_TASK:> Python Code: from jyquickhelper import add_notebook_menu add_notebook_menu() def distance_table(x1, y1, x2, y2): return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 distance_table(0, 0, 2, 1) def distance_bord(x1, y1, R): dist = distance_table(x1, y1, 0, 0) return R - dist distance_bord(1, 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: On sait d'après les dernières questions qu'il faudra tout répéter plusieurs fois. On prend le soin d'écrire chaque question dans une fonction. C...
8,167
<ASSISTANT_TASK:> Python Code: from __future__ import print_function from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("./mnist/", one_hot=True) # Load data x_train = mnist.train.images y_train = mnist.train.labels x_test = mnist.test.images y_test = mnist.test.labels 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: 数据维度 Step2: 数据可视化
8,168
<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: Distributed automl for time series forecasting using Chronos AutoTS Step 0 Step3: Step 1 Step4: This is the on...
8,169
<ASSISTANT_TASK:> Python Code: import pandas as pd df=pd.DataFrame({"Category":['Foo','Bar','Cho','Foo'],'Index':[1,2,3,4]}) filter_list=['Foo','Bar'] def g(df, filter_list): return df.query("Category == @filter_list") result = g(df.copy(), filter_list) <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:
8,170
<ASSISTANT_TASK:> Python Code: import os import sys sys.path.append(os.getcwd().replace("notebooks", "cfncluster")) ## Input the AWS account access keys aws_access_key_id = "/**aws_access_key_id**/" aws_secret_access_key = "/**aws_secret_access_key**/" ## CFNCluster name your_cluster_name = "cluster_name" ## The priva...
<SYSTEM_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. Install CFNCluster Step2: 2. Upgrade CFNCluster Step3: 3. Configure CFNCluster Step4: After you finish configuration, you can call the bel...
8,171
<ASSISTANT_TASK:> Python Code: import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import matplotlib.pyplot as plt #for plotting from collections import Counter from sklearn.metrics import confusion_matrix import itertools import seaborn as sns from subprocess impo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Loading The Dataset Step2: Normalising The Data Step3: Printing the shape of the Datasets Step4: ## Reshape To Match The Keras's Expectations...
8,172
<ASSISTANT_TASK:> Python Code: import torch import numpy as np from torchvision import datasets import torchvision.transforms as transforms # convert data to torch.FloatTensor transform = transforms.ToTensor() # load the training and test datasets train_data = datasets.MNIST(root='data', train=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: Visualize the Data Step2: Denoising Step3: Training Step4: Checking out the results
8,173
<ASSISTANT_TASK:> Python Code: import csv import time import h5py import numpy CROWDASTRO_H5_PATH = '../crowdastro.h5' CROWDASTRO_CSV_PATH = '../crowdastro.csv' ARCMIN = 0.0166667 with h5py.File(CROWDASTRO_H5_PATH) as f_h5: positions = f_h5['/swire/cdfs/catalogue'][:, :2] times = [] for i in range(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: Now let's try using a tree. I'll use a $k$-d tree to store SWIRE indices. Step2: Note that this measurement actually depends a lot on leafsize....
8,174
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.style as style style.use('ggplot') #print(style.available) import matplotlib.pyplot as plt %matplotlib inline import csv import datetime from IPython.core.display import display, HTML data = pd.read_csv("train.csv", header = 0) 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: Import data Step2: Cleaning Step3: Observations Step4: Prune outliers (similar approaches Step5: EDA Step6: Conclusions on cleaned data wit...
8,175
<ASSISTANT_TASK:> Python Code: # Use this when you want to nbconvert the notebook (used by nbviewer) from krisk import init_notebook; init_notebook() from krisk import Chart chart = Chart() chart chart.option chart.set_title('This is a blank visualization', x_pos='center') chart.set_theme('vintage') chart.option['se...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Here you see that there is a blank figure for chart that you want to use. You can inspect the characteristic of the chart by using its option me...
8,176
<ASSISTANT_TASK:> Python Code: import sys import os from itertools import count from pathlib import Path # Include utils.py for asvt_utils sys.path.insert(0, str(Path(os.environ['HOME'], 'git', 'skanb', 'pea-test-set'))) import utils as asvt_utils import numpy as np import matplotlib.pyplot as plt from astropy.table 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: Get acq stats data and clean Step2: Get ASVT data and make it look more like acq stats data Step3: Combine flight acqs and ASVT data Step4: C...
8,177
<ASSISTANT_TASK:> Python Code: %matplotlib inline import scipy as sp import matplotlib import pylab as pl matplotlib.rcParams.update({'font.size': 15}) from sklearn.linear_model import Ridge from sklearn.svm import SVC from sklearn.model_selection import KFold, StratifiedKFold, GridSearchCV,StratifiedShuffleSplit 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: 1.2 Train Ridge Regression on training data Step2: 1.3 Train Ridge Regression with optimal $\alpha$ and evaluate model in test data Step3: <di...
8,178
<ASSISTANT_TASK:> Python Code: import numpy as np from scipy.stats import beta import matplotlib.pyplot as plt def quadratic(x): return 4*x*(1-x) N = 100000 x = np.empty(N) # arbitary irrational starting point x[0] = 1/np.sqrt(3) for i in range(1, N): x[i] = quadratic( x[i-1] ) plt.plot(x[0:100]) plt.xlabel("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: And here's my code, using CDFs.
8,179
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 %matplotlib inline from fastai.imports import * from fastai.structured import * from pandas_summary import DataFrameSummary from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from IPython.display import display from sklearn 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: 2. Data Step2: Entering a DataFrame to display it will truncate it if it's too long. Step3: df_raw.tail() will show the last few rows of the D...
8,180
<ASSISTANT_TASK:> Python Code: %%python code=''' #include <iostream> #include <typeinfo> /// A trivial class class A { public: A(); ~A(); }; /// A trivial function int CountCharacters(const std::string s); /// A trivial template template<class T> class B { public: B() { std::cout << "The typeid name o...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Implementation Step2: Creation of the Library Step3: So far, so good. Now we'll see how easy it is to use this library from within Python than...
8,181
<ASSISTANT_TASK:> Python Code: # Data path/filename t_ind = 38 data_path = '../data/' file_name = data_path + 'data_sim_low.hdf5' data_options = {'flag_cell': True, 'flag_electode': False} data = data_in(file_name, **data_options) localization_options = {'p_vres':20, 'p_jlen':0, 'p_erad': 5, 't_ind': 38, 'flag_depthwe...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Next we define the inverse problem parameters as a dictionary. Parameter's not specified will be filled with default values. Step2: Now we are ...
8,182
<ASSISTANT_TASK:> Python Code: # Import libraries import py_stringsimjoin as ssj import py_stringmatching as sm import pandas as pd import os import sys print('python version: ' + sys.version) print('py_stringsimjoin version: ' + ssj.__version__) print('py_stringmatching version: ' + sm.__version__) print('pandas versi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Joining two tables using TD-IDF measure typically consists of six steps Step2: 2. Profiling the tables Step3: Based on the profile output, we ...
8,183
<ASSISTANT_TASK:> Python Code: #!pip install -I "phoebe>=2.4,<2.5" import phoebe from phoebe import u,c logger = phoebe.logger(clevel='WARNING') b = phoebe.default_binary() b.get_parameter(qualifier='sma', component='binary', context='component') b.get_parameter(qualifier='sma', component='binary', context='component...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Units Step2: From the representation above, we can already see that the units are in solar radii. We can access the units directly via get_def...
8,184
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bnu', 'sandbox-3', 'landice') # 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...
8,185
<ASSISTANT_TASK:> Python Code: %matplotlib inline import warnings warnings.simplefilter('ignore') import numpy from matplotlib import pyplot from scipy import stats import seaborn clear_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'} seaborn.set(style='ticks', context='talk', color_codes=True, rc=clear_bkgd...
<SYSTEM_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 different formulations of plotting positions Step2: Normal vs Weibull scales and Cunnane vs Weibull plotting positions Step3: Now let's ...
8,186
<ASSISTANT_TASK:> Python Code: ls ..\..\Scripts\hello-world*.py %%sh cat ../../Scripts/hello-world.py !python ..\..\Scripts\hello-world.py %%sh cat ../../Scripts/hello-world-in-swedish.py !python ../../Scripts/hello-world-in-swedish.py import math import math x = math.cos(2 * math.pi) print(x) from math 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: built in magic commands start with Step2: Character encoding Step3: Other than these two optional lines in the beginning of a Python code file...
8,187
<ASSISTANT_TASK:> Python Code: #!pip install --user --upgrade watson-developer-cloud #Making a local folder to put my data. #NOTE: YOU MUST do something like this on a Spark Enterprise cluster at the hackathon so that #you can put your data into a separate local file space. Otherwise, you'll likely collide with #your ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <br/> Step2: <br/> Step3: <br/> Step4: <br/> Step5: <br/> Step6: Generate CSV file for Scoreboard
8,188
<ASSISTANT_TASK:> Python Code: !pip3 install tensorflow import numpy as np import tensorflow as tf print(tf.__version__) users = ['Ryan', 'Danielle', 'Vijay', 'Chris'] movies = [ 'Star Wars', 'The Dark Knight', 'Shrek', 'The Incredibles', 'Bleu', 'Memento' ] features = ['Action', 'Sci-Fi', 'Comedy', 'Cartoon...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Make sure to restart your kernel to ensure this change has taken place. Step2: To start, we'll create our list of users, movies and features. W...
8,189
<ASSISTANT_TASK:> Python Code: # change working dir path = "/Users/albertlee/claritycontrol/code/scripts" # use your own path import os os.chdir(path) import numpy as np import matplotlib.pyplot as plt import os import csv import igraph as ig %matplotlib inline # Initializing dataset names dnames = list(['../data/hist'...
<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: Independent Graph Assumption Step2: From the above, we conclude that the assumption that the graphs were independent is false. This is b...
8,190
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np train = pd.read_csv('train.csv') test = pd.read_csv('test.csv') train.shape train.head() train.Age.hist() train.Age.describe() train[train['Age'] > 60][['Sex', 'Pclass', 'Age', 'Survived']] females = train[train['Sex'] == 'female...
<SYSTEM_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 Explore the data Step2: Now I'm starting to see a pattern here. Let's see how many female survived. Step3: Looks like the majority of pe...
8,191
<ASSISTANT_TASK:> Python Code: import time from collections import namedtuple import numpy as np import tensorflow as tf with open('anna.txt', 'r') as f: text=f.read() vocab = set(text) vocab_to_int = {c: i for i, c in enumerate(vocab)} int_to_vocab = dict(enumerate(vocab)) encoded = np.array([vocab_to_int[c] 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: First we'll load the text file and convert it into integers for our network to use. Here I'm creating a couple dictionaries to convert the chara...
8,192
<ASSISTANT_TASK:> Python Code: import magma as m m.set_mantle_target("ice40") from loam.boards.icestick import IceStick # Create an instance of an IceStick board icestick = IceStick() # Turn on the Clock # The clock must turned on because we are using a synchronous counter icestick.Clock.on() # Turn on the LED D5 ice...
<SYSTEM_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 next step is to setup the IceStick board. We import the class IceStick from Loam. Step2: Now that the IceStick setup is done, Step3: We ...
8,193
<ASSISTANT_TASK:> Python Code: from __future__ import print_function %matplotlib inline import matplotlib.pyplot as plt import openpathsampling as paths import numpy as np %%time storage = paths.AnalysisStorage("ala_mstis_production.nc") print("PathMovers:", len(storage.pathmovers)) print("Engines:", len(storage.engin...
<SYSTEM_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 optimum way to use storage depends on whether you're doing production or analysis. For analysis, you should open the file as an AnalysisStor...
8,194
<ASSISTANT_TASK:> Python Code: import numpy as np # Set up the data and network: n_outputs = 5 # We're attempting to learn XOR in this example, so our inputs and outputs will be the same. n_hidden_units = 10 # We'll use a single hidden layer with this number of hidden units in it. n_obs = 500 # How many observations...
<SYSTEM_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 data to learn from Step2: Select activation and loss functions Step3: Initialize the weights Step5: Forward propagation Step7: B...
8,195
<ASSISTANT_TASK:> Python Code: from scipy.io import loadmat dataset = loadmat('../datasets/mnist-data.mat') # comes as dictionary dataset.keys() import matplotlib.pyplot as plt %matplotlib inline import numpy as np # Example of a picture indexImage = 4000 # try any index between 0 and 4999. They are sorted, 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: Visualise the data Step2: 2 - Data preprocessing Step3: The second part of the training set is a 5000-dimensional vector y that contains label...
8,196
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import os import matplotlib.pyplot as plt !wget http://files.grouplens.org/datasets/movielens/ml-100k.zip !ls !unzip ml-100k folder = "ml-100k" !wget http://files.grouplens.org/datasets/movielens/ml-1m.zip !unzip ml-1m !ls folder = "ml-1m" ratings_li...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: These look good, but I want the format of my ratings matrix to be one row per user and one column per movie. I'll pivot ratings_df to get that a...
8,197
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline with open('itemsets.dat') as f: transactions = [] for row in f: transactions.append(row.strip().split(',')) transactions[0:5] items_counts = {} for tran in transactions: for item...
<SYSTEM_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. For a bit of EDA Step2: 3. Create a function to compute support for a given itemset from a transaction Step3: 4. Write an apriori function ...
8,198
<ASSISTANT_TASK:> Python Code: import os import matplotlib.pyplot as plt import numpy as np import openmc %matplotlib inline # Instantiate some elements elements = {} for elem in ['H', 'O', 'U', 'Zr', 'Gd', 'B', 'C', 'Fe']: elements[elem] = openmc.Element(elem) materials = {} # Fuel materials['Fuel'] = openmc.Mat...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We will be running a rodded 8x8 assembly with Gadolinia fuel pins. Let's create all the elemental data we would need for this case. Step2: With...
8,199
<ASSISTANT_TASK:> Python Code: from pprint import pprint from time import sleep from pynq import PL from pynq import Overlay from pynq.drivers import Trace_Buffer from pynq.iop import Pmod_OLED from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import ARDUINO ol = Overlay("base.bit") ol.download() ppri...
<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: Step 4 Step4: Step 5