Unnamed: 0
int64
0
16k
text_prompt
stringlengths
149
45.7k
code_prompt
stringlengths
67
140k
15,900
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: CSAL4243 Step1: Feature Scaling and Mean Normalization Step2: Initialize Hyper Parameters Step3: Model/Hypothesis Function Step5: Cost Function Ste...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt import matplotlib as mpl # read data in pandas frame dataframe = pd.read_csv('datasets/house_dataset2.csv', encoding='utf-8') # check data by printing first few rows ...
15,901
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: chart module This module relies on pygal library, so the returned charts are instances of pygal.chart. See options at pygal site I made a JavaScript '...
<ASSISTANT_TASK:> Python Code: import ee from geetools import ui test_site = ee.Geometry.Point([-71, -42]) test_feat = ee.Feature(test_site, {'name': 'test feature'}) test_featcol = ee.FeatureCollection([ test_feat, test_feat.buffer(100).set('name', 'buffer 100'), test_feat.buffer(1000).set('name', 'buffer...
15,902
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Truncated potentials for long-range electrostatics Björn Stenqvist and Mikael Lund, Div. of Theoretical Chemistry, Lund University, Sweden, 2016 In thi...
<ASSISTANT_TASK:> Python Code: %matplotlib inline from simtk.openmm.app import * from simtk.openmm import * from simtk.unit import * from sys import stdout import matplotlib, matplotlib.pyplot as plt import pandas as pd from io import StringIO import numpy as np, os matplotlib.rcParams.update({'font.size': 12}) # simul...
15,903
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: A simple method for segmenting rectilinear crop plots The following outlines the method in https Step1: Read in a test image subset. Replace with your...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import cv2 from geospatial_learn import raster from geospatial_learn.utilities import do_phasecong, houghseg from math import ceil import matplotlib.pyplot as plt from skimage.color import rgb2gray, label2rgb from skimage.feature import canny from skimage.exposure impo...
15,904
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Basic notebook to look @ convergence of a 2D region in an FES. It will actually call sum hills with the stride you set in cell one , graph the FES and ...
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import glob import os from matplotlib.patches import Rectangle # define all variables for convergence script # these will pass to the bash magic below used to call plumed sum_hills dir="MetaD_converge" #where the intermediate fes will be...
15,905
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Batch Normalization – Lesson What is it? What are it's benefits? How do we add it to a network? Let's see it work! What are you hiding? What is Batch N...
<ASSISTANT_TASK:> Python Code: # Import necessary packages import tensorflow as tf import tqdm import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Import MNIST data so we have something for our experiments from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("...
15,906
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Training DeepMind's Atari DQN with Chimp Load Chimp modules Step1: Load Python packages Step2: Set training parameters Step3: You may want to set a ...
<ASSISTANT_TASK:> Python Code: from chimp.memories import ReplayMemoryHDF5 from chimp.learners.dqn_learner import DQNLearner from chimp.learners.chainer_backend import ChainerBackend from chimp.simulators.atari import AtariSimulator from chimp.agents import DQNAgent Explanation: Training DeepMind's Atari DQN with Chimp...
15,907
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2020 Google LLC. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the Lice...
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import numpy as np import pandas as pd import random import sys from sklearn import model_selection import tensorflow as tf !pip install git+https://github.com/google-research/tensorflow_constrained_optimization import tensorflow_constrained_optimization as...
15,908
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Whitening evoked data with a noise covariance Evoked data are loaded and then whitened using a given noise covariance matrix. It's an excellent quality...
<ASSISTANT_TASK:> Python Code: # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne import io from mne.datasets import sample from mne.cov import compute_covariance print(__doc__) Explanation: Whit...
15,909
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: &larr; Back to Index NumPy and SciPy The quartet of NumPy, SciPy, Matplotlib, and IPython is a popular combination in the Python world. We will use eac...
<ASSISTANT_TASK:> Python Code: print numpy.arange(5) print numpy.linspace(0, 5, 10, endpoint=False) print numpy.zeros(5) print numpy.ones(5) print numpy.ones((5,2)) print scipy.randn(5) # random Gaussian, zero-mean unit-variance print scipy.randn(5,2) Explanation: &larr; Back to Index NumPy and SciPy The quartet of Num...
15,910
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Deep Convolutional Neural Network in TensorFlow In this notebook, we convert our LeNet-5-inspired, MNIST-classifying, deep convolutional network from K...
<ASSISTANT_TASK:> Python Code: import numpy as np np.random.seed(42) import tensorflow as tf tf.set_random_seed(42) Explanation: Deep Convolutional Neural Network in TensorFlow In this notebook, we convert our LeNet-5-inspired, MNIST-classifying, deep convolutional network from Keras to TensorFlow (compare them side by...
15,911
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sparse CNN The idea of the sparse CNN is to utilize only the important values of its filters and set those less impotant to zero. For terminology, we'l...
<ASSISTANT_TASK:> Python Code: c_out = 7 c_in = 8 conv = torch.nn.Conv2d(c_in, c_out, kernel_size=(2, 2), stride=(1, 1), padding=0, dilation=1, groups=1) input_tensor = torch.randn(2, c_in, 5, 3) output_tensor = conv(input_tensor) # Get params of conv layer. in_channels = conv.in_channels # Number of channels in the i...
15,912
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Compute ICA components on epochs ICA is fit to MEG raw data. We assume that the non-stationary EOG artifacts have already been removed. The sources mat...
<ASSISTANT_TASK:> Python Code: # Authors: Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne.preprocessing import ICA, create_ecg_epochs from mne.datasets import sample print(__doc__) Explanation: Compute ICA components on epochs ICA is fit to MEG raw data. We assume that the non-...
15,913
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Class Session 4 Exercise Step1: Now, define a function that returns the index numbers of the neighbors of a vertex i, when the graph is stored in adj...
<ASSISTANT_TASK:> Python Code: import numpy as np import igraph import timeit import itertools Explanation: Class Session 4 Exercise: Comparing asymptotic running time for enumerating neighbors of all vertices in a graph We will measure the running time for enumerating the neighbor vertices for three different data str...
15,914
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Recommender Engine Perhaps the most famous example of a recommender engine in the Data Science world was the Netflix competition started in 2006, in ...
<ASSISTANT_TASK:> Python Code: # Importing the data import pandas as pd import numpy as np header = ['user_id', 'item_id', 'rating', 'timestamp'] data_movie_raw = pd.read_csv('../data/ml-100k/u.data', sep='\t', names=header) data_movie_raw.head() Explanation: Recommender Engine Perhaps the most famous example of a rec...
15,915
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Unsupervised Analysis of Days of Week Treating crossing each day as features to learn about the relatinships between various days. Step1: Downloading ...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt Explanation: Unsupervised Analysis of Days of Week Treating crossing each day as features to learn about the relatinships between various days. End of explanation from urllib import request FREMONT_URL = 'https://data.seattle.gov/api/view...
15,916
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: OCCT Bottle Tutorial Step1: VTK Viewer The following summarizes the mouse and keyboard commands for interacting with shapes rendered in the viewer. Ke...
<ASSISTANT_TASK:> Python Code: height = 70. width = 50. thickness = 30. pnt1 = [-width/2., 0., 0.] pnt2 = [-width/2., -thickness/4., 0.] pnt3 = [0., -thickness/2., 0.] pnt4 = [width/2., -thickness/4., 0.] pnt5 = [width/2., 0., 0.] edge1 = Edge().createLine(start=pnt1, end=pnt2) edge2 = Ed...
15,917
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Wind energy production forecast from Met.no weather forecast With this notebook we illustrate how one might improve weather forecast for wind energy pr...
<ASSISTANT_TASK:> Python Code: %matplotlib notebook import urllib.request import numpy as np import simplejson as json import matplotlib.pyplot as plt import matplotlib.dates as mdates import warnings import datetime import dateutil.parser import matplotlib.cbook warnings.filterwarnings("ignore",category=matplotlib.cbo...
15,918
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: 596 Step1: Discovering available alignments Alignments for a specified transcript This approach identifies available alignments and then selects the d...
<ASSISTANT_TASK:> Python Code: from hgvs.easy import (__version__, parser, hdp, vm) from hgvs.exceptions import HGVSDataNotAvailableError __version__ # hgvs_g = "NC_000010.11:g.94762693G>A" # GRCh38 hgvs_g = "NC_000010.10:g.96522450G>A" # GRCh37 hgvs_c = "NM_000769.4:c.-13G>A" var_c = parser.parse(hgvs_c) var_g = par...
15,919
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: The decimal module implements fixed and floating point arithmetic using the model familiar to most people, rather than the IEEE floating point version ...
<ASSISTANT_TASK:> Python Code: import decimal fmt = '{0:<25}{1:<25}' print(fmt.format('Input', 'Output')) print(fmt.format('-'*25, '-'*25)) #Integer print(fmt.format(5, decimal.Decimal(5))) #String print(fmt.format('3.14', decimal.Decimal('3.14'))) #Float f = 0.1 print(fmt.format(repr(f), decimal.Decimal(str(f)))) prin...
15,920
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ModelSelection.ipynb Choosing the number of states and a suitable timescale for hidden Markov models One of the challenges associated with using hidden...
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import sys from IPython.display import display, clear_output sys.path.insert(0, 'helpers') from efunctions import * # load my helper function(s) to save pdf figures, etc. from hc3 import load_data...
15,921
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Basics of Marvin In this notebook, you will learn the common core functionality across many of the Marvin Tools. This includes the basics of accessing...
<ASSISTANT_TASK:> Python Code: from marvin.tools import Cube Explanation: Basics of Marvin In this notebook, you will learn the common core functionality across many of the Marvin Tools. This includes the basics of accessing and handling MaNGA data from different locations, as well as a beginners guide of interacting ...
15,922
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: The big reset So I went ahead and cleared the memory. Step1: The mystery section remains the same. Step2: All the blocks are empty. Step3: The 'Pres...
<ASSISTANT_TASK:> Python Code: import sys sys.path.append('..') import collections import mido from commons import dgxdump from commons.dumpdata import messages, songdata, regdata, regvalues old_syx_messages = mido.read_syx_file('../data/syxout5.syx') clear_syx_messages = mido.read_syx_file('../data/clear_bulk.txt') o_...
15,923
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Numpy Exercise 4 Imports Step1: Complete graph Laplacian In discrete mathematics a Graph is a set of vertices or nodes that are connected to each othe...
<ASSISTANT_TASK:> Python Code: import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns Explanation: Numpy Exercise 4 Imports End of explanation import networkx as nx K_5=nx.complete_graph(5) nx.draw(K_5) Explanation: Complete graph Laplacian In discrete mathematics a Graph is a set o...
15,924
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Ocean MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contributors...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'messy-consortium', 'sandbox-2', 'ocean') Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MESSY-CONSORTIUM Source ID: SANDBOX-2 Topic: Oc...
15,925
<SYSTEM_TASK:> Given the following text problem statement, write Python code to implement the functionality described below in problem statement <END_TASK> <USER_TASK:> Problem: Given a distance matrix, with similarity between various fruits :
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import sklearn.cluster simM = load_data() model = sklearn.cluster.AgglomerativeClustering(affinity='precomputed', n_clusters=2, linkage='complete').fit(simM) cluster_labels = model.labels_ <END_TASK>
15,926
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Vertex SDK Step1: Restart the Kernel Once you've installed the Vertex SDK and Google cloud-storage, you need to restart the notebook kernel so it can ...
<ASSISTANT_TASK:> Python Code: ! pip3 install google-cloud-storage Explanation: Vertex SDK: Train & deploy a TensorFlow model with hosted runtimes (aka pre-built containers) Installation Install the Google cloud-storage library as well. End of explanation import os if not os.getenv("AUTORUN"): # Automatically resta...
15,927
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <p> <img src="http Step1: Stirling array $\mathcal{S}$ Step2: power function Step3: inverse function Step4: sqrt function Step5: expt function Ste...
<ASSISTANT_TASK:> Python Code: from sympy import * from sympy.abc import n, i, N, x, lamda, phi, z, j, r, k, a, alpha from commons import * from matrix_functions import * from sequences import * import functions_catalog init_printing() Explanation: <p> <img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_posi...
15,928
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sets & Frozen Sets A set in python is an unordered sequence of unique and immutable objects, although the set itself is mutable. A frozen set is the sa...
<ASSISTANT_TASK:> Python Code: # from a list a = set([1,2,3,4]) a # using curly braces a = {1,2,3,4} a # using a tuple a = set((1,2,3,4)) a # start with and empty set and add elements to it a = set() a.add('hello') a # be careful in assigning a string as an element to a set. If assigned as below, it'll be broken up and...
15,929
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Principal Component Analysis by Rene Zhang and Max Margenot Part of the Quantopian Lecture Series Step1: We will introduce PCA with an image processin...
<ASSISTANT_TASK:> Python Code: from numpy import linalg as LA import numpy as np import pandas as pd import matplotlib.pyplot as plt Explanation: Principal Component Analysis by Rene Zhang and Max Margenot Part of the Quantopian Lecture Series: www.quantopian.com/lectures https://github.com/quantopian/research_public A...
15,930
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Face Generation In this project, you'll use generative adversarial networks to generate new images of faces. Get the Data You'll be using two da...
<ASSISTANT_TASK:> Python Code: data_dir = './data' # FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe" #data_dir = '/input' DON'T MODIFY ANYTHING IN THIS CELL import helper helper.download_extract('mnist', data_dir) helper.download_extract('celeba', data_dir) Explanation: Face Generation In this project, you'll use ...
15,931
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural network that performs sentiment analysis. Using an RNN rather than...
<ASSISTANT_TASK:> Python Code: import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels_orig = f.read() reviews[:2000] Explanation: Sentiment Analysis with an RNN In this notebook, you'll...
15,932
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Workshop – Introduction to Neural Networks using TensorFlow and Keras http Step1: How does Tensorflow Low Level API look like? Step2: Interactive usa...
<ASSISTANT_TASK:> Python Code: import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline from distutils.version import StrictVersion import sklearn print(sklearn.__version__) assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1') import tensorflow as tf tf.logging.set_verbosity(t...
15,933
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Qualité de l'air mesurée dans la station Châtelet Source de données utilisée (fichiers CSV en open data) Step1: Infos diverses sur le DataFrame Step2:...
<ASSISTANT_TASK:> Python Code: %matplotlib inline #%matplotlib notebook import matplotlib matplotlib.rcParams['figure.figsize'] = (9, 9) import pandas as pd def conv_func(s): s = s.replace('<', '') if s == 'ND': return np.nan elif s.strip() == '': return np.nan else: return float...
15,934
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Factorial HMM Example synthetic data Step1: Test out learned distribution inside of SMC We'll compare it against a baseline of "bootstrap" SMC, which ...
<ASSISTANT_TASK:> Python Code: devices = factorial_hmm.gen_devices() T = 50 np.random.seed(20) X, Y = factorial_hmm.gen_dataset(devices, T) plt.figure(figsize=(15,3.5)) plt.plot(Y) plt.figure(figsize=(15,10)) plt.imshow((X*devices).T, interpolation='None', aspect=1); plt.yticks(np.arange(len(devices)), devices); print ...
15,935
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Gaussian Process Regression in Pytorch Thomas Viehmann, &#116;&#118;&#64;&#108;&#101;&#114;&#110;&#97;&#112;&#112;&#97;&#114;&#97;&#116;&#46;&#100;&#10...
<ASSISTANT_TASK:> Python Code: from matplotlib import pyplot %matplotlib inline import IPython import torch import numpy import sys, os sys.path.append(os.path.join(os.getcwd(),'..')) pyplot.style.use('ggplot') import candlegp import candlegp.training.hmc Explanation: Gaussian Process Regression in Pytorch Thomas Viehm...
15,936
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Basic Principles of Machine Learning Here we'll dive into the basic principles of machine learning, and how to utilize them via the Scikit-Learn API. A...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import matplotlib.pyplot as plt Explanation: Basic Principles of Machine Learning Here we'll dive into the basic principles of machine learning, and how to utilize them via the Scikit-Learn API. After briefly introducing scikit-learn's Estimator objec...
15,937
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: This is functionally similar to the the other notebook. All the operations here have been vectorized. This results in much much faster code, but is als...
<ASSISTANT_TASK:> Python Code: import numpy as np Explanation: This is functionally similar to the the other notebook. All the operations here have been vectorized. This results in much much faster code, but is also much unreadable. The vectorization also necessitated the replacement of the Gauss-Seidel smoother with u...
15,938
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Lab 1 Step1: The core tables in the data warehouse are derived from 5 separate core operational systems (each with many tables) Step2: Question Step3...
<ASSISTANT_TASK:> Python Code: %%bigquery SELECT dataset_id, table_id, -- Convert bytes to GB. ROUND(size_bytes/pow(10,9),2) as size_gb, -- Convert UNIX EPOCH to a timestamp. TIMESTAMP_MILLIS(creation_time) AS creation_time, TIMESTAMP_MILLIS(last_modified_time) as last_modified_time, row_count, CASE ...
15,939
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Задание 1 Написать функцию на языке Python, формирующую список всех исполнителей композиций жанра Рок. Список должен быть упорядочен в порядке убывания...
<ASSISTANT_TASK:> Python Code: def task1(): cursor = db.cursor() cursor.execute(''' select distinct ar.Name from tracks t inner join albums al on t.albumid = al.albumid inner join artists ar on al.artistid = ar.artistid inner join genres g on t.genreid = g.genreid where g.name = 'Rock' ...
15,940
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Bayesian Hierarchical Stacking Step1: 1. Exploratory Data Analysis <a class="anchor" id="1"></a> The data we have to work with looks at households in ...
<ASSISTANT_TASK:> Python Code: !pip install -q numpyro@git+https://github.com/pyro-ppl/numpyro import os from IPython.display import set_matplotlib_formats import arviz as az import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.interpolate import BSpline import seaborn as sns import jax imp...
15,941
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Paris Saclay Center for Data Science Titanic RAMP Step1: Exploratory data analysis Loading the data Step2: The original training data frame has 891 r...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import glob import numpy as np from scipy import io import matplotlib.pyplot as plt import pandas as pd Explanation: Paris Saclay Center for Data Science Titanic RAMP: survival prediction of Titanic passengers Benoit Playe (Institut Curie/Mines ParisTech), Chl...
15,942
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: QuTiP Lecture Step1: Introduction The quantum two-level system (TLS) is the simplest possible model for quantum light-matter interaction. In the versi...
<ASSISTANT_TASK:> Python Code: %matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import interp2d from qutip import * Explanation: QuTiP Lecture: Pulse-wise two-photon interference of emission from a two-level system K.A. Fischer, ...
15,943
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Comparing surrogate models Tim Head, July 2016. Step1: Bayesian optimization or sequential model-based optimization uses a surrogate model to model th...
<ASSISTANT_TASK:> Python Code: import numpy as np np.random.seed(123) %matplotlib inline import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (10, 6) plt.set_cmap("viridis") Explanation: Comparing surrogate models Tim Head, July 2016. End of explanation from skopt.benchmarks import branin as _branin def bra...
15,944
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Land MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contributors ...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'land') Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: TEST-INSTITUTE-3 Source ID: SANDBOX-1 Topic: Land...
15,945
<SYSTEM_TASK:> Given the following text problem statement, write Python code to implement the functionality described below in problem statement <END_TASK> <USER_TASK:> Problem: I'm using tensorflow 2.10.0.
<ASSISTANT_TASK:> Python Code: import tensorflow as tf import numpy as np np.random.seed(10) a = tf.constant(np.random.rand(50, 100, 512)) def g(a): return tf.expand_dims(a, 2) result = g(a.__copy__()) <END_TASK>
15,946
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Collation outputs Introduction In practice Table Step1: Table Step2: Before moving to the other outputs, try to produce the simple HTML output by cha...
<ASSISTANT_TASK:> Python Code: #import the collatex library from collatex import * #create an instance of the collateX engine collation = Collation() #add witnesses to the collateX instance collation.add_plain_witness( "A", "The quick brown fox jumped over the lazy dog.") collation.add_plain_witness( "B", "The brown fo...
15,947
<SYSTEM_TASK:> Given the following text problem statement, write Python code to implement the functionality described below in problem statement <END_TASK> <USER_TASK:> Problem: How do I find all rows in a pandas DataFrame which have the max value for count column, after grouping by ['Sp','Value'] columns?
<ASSISTANT_TASK:> Python Code: import pandas as pd df = pd.DataFrame({'Sp':['MM1','MM1','MM1','MM2','MM2','MM2','MM4','MM4','MM4'], 'Value':['S1','S1','S3','S3','S4','S4','S2','S2','S2'], 'Mt':['a','n','cb','mk','bg','dgd','rd','cb','uyi'], 'count':[3,2,5,8,10,1,...
15,948
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Study of Correlation Between Building Demolition and Associated Features Capstone Project for Data Science at Scale on Coursera Repo is located here Ch...
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.pyplot as plt from IPython.display import Image %matplotlib inline Explanation: Study of Correlation Between Building Demolition and Associated Features Capstone Project for Data Science at Scale on Coursera Repo is located here Che...
15,949
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Histograma e Estatística de uma imagem Histograma de uma imagem A imagem normalmente é composta de um grande número de pixels; hoje em dia, celulares t...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import sys,os ia898path = os.path.abspath('../../') if ia898path not in sys.path: sys.path.append(ia898path) import ia898.src as ia !ls -l ../../ia898/data f = mpimg.imread('../d...
15,950
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: The Basic Tools of the Deep Life Sciences Welcome to DeepChem's introductory tutorial for the deep life sciences. This series of notebooks is a step-by...
<ASSISTANT_TASK:> Python Code: !pip install --pre deepchem Explanation: The Basic Tools of the Deep Life Sciences Welcome to DeepChem's introductory tutorial for the deep life sciences. This series of notebooks is a step-by-step guide for you to get to know the new tools and techniques needed to do deep learning for th...
15,951
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: DV360 Automation Step1: 0.2 Setup your GCP project To utilise the DV360 API, you need a Google Cloud project. For the purpose of this workshop, we've ...
<ASSISTANT_TASK:> Python Code: !pip install google-api-python-client !pip install google-cloud-vision import csv import datetime import io import json import pprint from google.api_core import retry from google.cloud import vision from google.colab import files from google_auth_oauthlib.flow import InstalledAppFlow fro...
15,952
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Graphical User Interfaces Object oriented programming and particularly inheritance is commonly used for creating GUIs. There are a large number of diff...
<ASSISTANT_TASK:> Python Code: import tkinter as tk class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack() self.createWidgets() def createWidgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Hello World...
15,953
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Basics of NUmpy & Pandas Numpy Numpy uses array whereas pandas used scaler <br /> Step1: Array are similar to python list , but it all element must be...
<ASSISTANT_TASK:> Python Code: import numpy as np Explanation: Basics of NUmpy & Pandas Numpy Numpy uses array whereas pandas used scaler <br /> End of explanation num = np.array([3,4,2,5,7,23,56,23,7,23,89,43,676,43]) num Explanation: Array are similar to python list , but it all element must be of same data type, and...
15,954
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: NoSQL (MongoDB) (Ejemplo de Replica Set y Sharding) Esta hoja muestra cómo crear un clúster (simulado con docker-compose donde se mantienen dos replica...
<ASSISTANT_TASK:> Python Code: !pip install --upgrade pymongo from pprint import pprint as pp import pandas as pd import matplotlib.pyplot as plt import matplotlib %matplotlib inline matplotlib.style.use('ggplot') %%bash sudo apt-get update sudo apt-get install -y mongodb-clients Explanation: NoSQL (MongoDB) (Ejemplo d...
15,955
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Using a Pre-trained PyTorch Model for Inference In this demo, we will use a pre-trained model to perform inference on a single image. There are 3 comp...
<ASSISTANT_TASK:> Python Code: import torch import torchvision import torchvision.transforms as transforms import timm from einops import rearrange from PIL import Image Explanation: Using a Pre-trained PyTorch Model for Inference In this demo, we will use a pre-trained model to perform inference on a single image. ...
15,956
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sweden Step1: 2. Join data to identify common water samples The recent data from Salar includes more water samples than are currently in RESA2. In add...
<ASSISTANT_TASK:> Python Code: # Read data in_xls = (r'C:\Data\James_Work\Staff\Heleen_d_W\ICP_Waters\TOC_Trends_Analysis_2015' r'\Swedish_Ca_Data\Missing_Data_25_Swedish_Sites.xlsx') smhi_df = pd.read_excel(in_xls, sheetname='salar_data') resa_df = pd.read_excel(in_xls, sheetname='from_resa_10-02-2017') # Ge...
15,957
<SYSTEM_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 In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a se...
<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) Explanation: Language Translation In this proj...
15,958
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Aerosol MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contributo...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-3', 'aerosol') Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: CMCC Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Tr...
15,959
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Use Word2Vec in gensim to train a word embedding model using the content from NIPS papers. Step1: Gensim word2vec https Step2: Train a word2vec model...
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 %matplotlib inline #%config InlineBackend.figure_format = 'svg' #config InlineBackend.figure_format = 'pdf' from IPython.core.display import HTML import gensim as gen import gensim.models.word2vec as w2v import matplotlib.pyplot as plt from nltk.tokenize...
15,960
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Using ICsound csoundmagics includes an ICsound class which is adapted from Andrés Cabrera's icsound module. ICsound is bound to the %%csound and %csoun...
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt %load_ext csoundmagics Explanation: Using ICsound csoundmagics includes an ICsound class which is adapted from Andrés Cabrera's icsound module. ICsound is bound to the %%csound and %csound magics command. This notebook is an adaptation of...
15,961
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Udacity MLND Capstone Project "Determination of students’ interaction patterns with an intelligent tutoring system and study of their correlation with ...
<ASSISTANT_TASK:> Python Code: # Select test_size and random_state for splitting a subset test_size=0.1 random_state=0 import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cm import time import gzip import shutil import seaborn as sns from collections import ...
15,962
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Introduction to NLTK We have seen how to do some basic text processing in Python, now we introduce an open source framework for natural language proces...
<ASSISTANT_TASK:> Python Code: sampleText1 = "The Elephant's 4 legs: THE Pub! You can't believe it or can you, the believer?" sampleText2 = "Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29." Explanation: Introduction to NLTK We have seen how to do some basic text processing in Python...
15,963
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: SciPy for Economists Scipy provides many user-friendly and efficient numerical routines, e.g. numerical integration and optimization. The full document...
<ASSISTANT_TASK:> Python Code: # standard library import numpy as np # Parametrization num_agents = 1000 num_covars = 3 betas_true = np.array([0.22, 0.30, -0.1]).T sd_true = 0.01 # Sampling of observables np.random.seed(123) X = np.random.rand(num_agents, num_covars) X[:,0] = 1 # Sampling disturbances eps = np.rando...
15,964
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Graded = 7/8 Step1: & for multiple parameters Step2: 2) What genres are most represented in the search results? Edit your previous printout to also d...
<ASSISTANT_TASK:> Python Code: import requests response = requests.get('https://api.spotify.com/v1/search?query=lil&type=artist&market=US&limit=50') Explanation: Graded = 7/8 End of explanation data = response.json() data.keys() artist_data = data['artists'] artist_data.keys() lil_names = artist_data['items'] #lil_name...
15,965
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Convolutional Neural Networks Step1: Run the next cell to load the "SIGNS" dataset you are going to use. Step2: As a reminder, the SIGNS dataset is a...
<ASSISTANT_TASK:> Python Code: import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage import tensorflow as tf from tensorflow.python.framework import ops from cnn_utils import * %matplotlib inline np.random.seed(1) Explanation: Convolution...
15,966
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Softmax exercise Adapt from the Stanford CS231n assignment1, find the original version on the course website. In this exercise we will Step5: Load CIF...
<ASSISTANT_TASK:> Python Code: import random import time import numpy as np import matplotlib.pyplot as plt from cs231n.data_utils import load_CIFAR10 from cs231n.gradient_check import grad_check_sparse # plotting setting %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rc...
15,967
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Opinion Game - One Topic in the network These codes were developed as a part of the our opinion game model. Import Python built-in functions we need to...
<ASSISTANT_TASK:> Python Code: import numpy as np from numpy.random import randn import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt import matplotlib.animation as animation import matplotlib.image as mpimg from matplotlib import rcParams import seaborn as sb Explanation: Opinion Ga...
15,968
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: LogGabor user guide Table of content What is the LogGabor package? Installing Importing the library Properties of log-Gabor filters Testing filter ge...
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 from LogGabor import LogGabor parameterfile = 'https://raw.githubusercontent.com/bicv/LogGabor/master/default_param.py' lg = LogGabor(parameterfile) lg.set_size((32, 32)) Explanation: LogGabor user guide Table of content What is the LogGabor package? In...
15,969
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Porting Bike-Sharing project-1 to RNN Step1: Load and prepare the data A critical step in working with neural networks is preparing the data correctly...
<ASSISTANT_TASK:> Python Code: %matplotlib inline %config InlineBackend.figure_format = 'retina' import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt Explanation: Porting Bike-Sharing project-1 to RNN End of explanation data_path = 'Bike-Sharing-Dataset/hour.csv' rides = pd.read_csv(data_pa...
15,970
<SYSTEM_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: Cтандартный блок, в котором мы получаем по ссылке текст страницы в у...
<ASSISTANT_TASK:> Python Code: district = 'http://www.cian.ru/cat.php?deal_type=sale&district%5B0%5D=13&district%5B1%5D=14&district%5B2%5D=15&district%5B3%5D=16&district%5B4%5D=17&district%5B5%5D=18&district%5B6%5D=19&district%5B7%5D=20&district%5B8%5D=21&district%5B9%5D=22&engine_version=2&offer_type=flat&p={}&room1=1...
15,971
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Table of Contents <p><div class="lev1"><a href="#Data-preparation"><span class="toc-item-num">1 - </span>Data preparation</a></div><div class="lev1"><a...
<ASSISTANT_TASK:> Python Code: # for plotting purposes %matplotlib inline from matplotlib.pylab import plt from matplotlib import rcParams dark_colors = ["#A51C30", "#808080", (0.8509803921568627, 0.37254901960784315, 0.00784313725490196), (0.4588235294117647, 0.4392156862745098, 0.70196...
15,972
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Could not find kernel error? If you ever see a "could not find a kernel for this notebook" error message, it will offer you a pull down menu for you to...
<ASSISTANT_TASK:> Python Code: tempF = 212.0 tempC = (5 / 9) * (tempF - 32.0) tempC Explanation: Could not find kernel error? If you ever see a "could not find a kernel for this notebook" error message, it will offer you a pull down menu for you to pick a fitting kernel. Remember, kernels are the notebook's way to find...
15,973
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Transform EEG data using current source density (CSD) This script shows an example of how to use CSD [1] [2] [3]_. CSD takes the spatial Laplacian of t...
<ASSISTANT_TASK:> Python Code: # Authors: Alex Rockhill <aprockhill206@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() Explanation: Transform EEG data using current source density (CSD) Thi...
15,974
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Unsupervised learning Step1: First, we start with some exploratory clustering, visualizing the clustering dendrogram using SciPy's linkage and dendrog...
<ASSISTANT_TASK:> Python Code: from sklearn.datasets import load_iris iris = load_iris() X = iris.data[:, [2, 3]] y = iris.target n_samples, n_features = X.shape plt.scatter(X[:, 0], X[:, 1], c=y); Explanation: Unsupervised learning: Hierarchical and density-based clustering algorithms In a previous notebook, "08 Unsup...
15,975
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Estimating At-Work Subtour Frequency This notebook illustrates how to re-estimate a single model component for ActivitySim. This process includes run...
<ASSISTANT_TASK:> Python Code: import os import larch # !conda install larch -c conda-forge # for estimation import pandas as pd Explanation: Estimating At-Work Subtour Frequency This notebook illustrates how to re-estimate a single model component for ActivitySim. This process includes running ActivitySim in estima...