Unnamed: 0 int64 0 15.9k | cleaned_code stringlengths 67 124k ⌀ | cleaned_prompt stringlengths 168 30.3k ⌀ |
|---|---|---|
800 | <ASSISTANT_TASK:>
Python Code:
from datetime import datetime, timedelta
import cartopy.crs as ccrs
import pandas as pd
from metpy.cbook import get_test_data
import metpy.plots as mpplots
data = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False),
infer_datetime_format=True, parse_dates=['val... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Getting the data
Step2: Plotting the data
|
801 | <ASSISTANT_TASK:>
Python Code:
from nipype.interfaces.base import Bunch
conditions = ['faces', 'houses', 'scrambled pix']
onsets = [[0, 30, 60, 90],
[10, 40, 70, 100],
[20, 50, 80, 110]]
durations = [[3], [3], [3]]
subject_info = Bunch(conditions=conditions,
onsets=onsets,
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: It's also possible to specify additional regressors. For this you need to additionally specify
Step2: So, the only things that we need to speci... |
802 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
from astropy.table import QTable
import astropy.units as u
from astropy.time import Time
from astropy.coordinates import SkyCoord, EarthLocation
import pytz
from astroplan import Observer, FixedTarget
import warnings
warnings.filterwarnings('ignore', category=Warning)
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: List Comprehensions
Step2: You can do the same thing with
Step3: You can include if statements
Step4: You can do the same thing with
Step5: ... |
803 | <ASSISTANT_TASK:>
Python Code:
import pprint
def get_client():
from pymongo import MongoClient
return MongoClient('mongodb://localhost:27017/')
def get_collection():
return get_client().examples.twitter
collection = get_collection()
def aggregate_and_show(collection, query, limit = True):
_query = query... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Aggregation Operators
Step2: For $match we use the same syntax that we use for read operations
Step3: group operators
|
804 | <ASSISTANT_TASK:>
Python Code:
#Import Relevant Modules and Packages
import pandas as pd
import numpy as np
from sklearn.svm import SVC
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn import preprocessing
from sklearn.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: 2.1) Dealing with Missing Values – Imputation
Step2: A couple of imputation methods were tried in the original Notebook
Step3: 2.2) Dealing wi... |
805 | <ASSISTANT_TASK:>
Python Code:
from cobra import Model, Reaction, Metabolite
# Best practise: SBML compliant IDs
cobra_model = Model('example_cobra_model')
reaction = Reaction('3OAS140')
reaction.name = '3 oxoacyl acyl carrier protein synthase n C140 '
reaction.subsystem = 'Cell Envelope Biosynthesis'
reaction.lower_bo... | <SYSTEM_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 need to create metabolites as well. If we were using an existing model, we could use get_by_id to get the apporpriate Metabolite objects inst... |
806 | <ASSISTANT_TASK:>
Python Code:
# Store even numbers from 0 to 20
even_lst = [num for num in range(21) if num % 2 == 0]
print(even_lst)
cash_value = 20
rsu_dict = {"Max":20, "Willie":13, "Joanna":14}
lst = [rsu_dict[name]*cash_value for name in rsu_dict]
print(lst)
my_dict = {"Ross":19, "Bernie":13, "Micah":15}
cash_va... | <SYSTEM_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 Convert the reserved stock units (RSUs) an employee has in a company to the current cash value.
Step2: Let's take a look at some valu... |
807 | <ASSISTANT_TASK:>
Python Code:
import librosa.display
import mir_eval.display
librosa.display.specshow(S, x_axis='time', y_axis='mel')
mir_eval.display.events(ref_beats, color='w', alpha=0.8, linewidth=3)
mir_eval.display.events(est_beats, color='c', alpha=0.8, linewidth=3, linestyle='--')
y_harm, y_perc = librosa.ef... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Common plots
Step2: Example
|
808 | <ASSISTANT_TASK:>
Python Code:
# %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# import pylab
# Required imports
from wikitools import wiki
from wikitools import category
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer... | <SYSTEM_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. Corpus acquisition.
Step2: You can try with any other categories. Take into account that the behavior of topic modelling algorithms may depe... |
809 | <ASSISTANT_TASK:>
Python Code:
import os
import tensorflow as tf
# import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
import pandas as pd
# Create the TensorFlow graph
def create_graph():
model_dir = './CNW_Wildlife_Identification/imagenet'
with gfile.FastGFile(os... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Some Functions for working with Inception-v3
Step2: Putting it to use!
Step3: How about more than one image
|
810 | <ASSISTANT_TASK:>
Python Code:
# Autograd will be used for later, so the numpy wrapper for Autograd must be imported
import autograd.numpy as np
from autograd import grad, elementwise_grad
import autograd.numpy.random as npr
from matplotlib import pyplot as plt
def sigmoid(z):
return 1/(1 + np.exp(-z))
def neural_n... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Backpropagation
Step2: Gradient Descent
Step3: An implementation of a Deep Neural Network
Step4: Backpropagation
Step5: Solving the ODE
Step... |
811 | <ASSISTANT_TASK:>
Python Code:
%run "../Functions/8. RM-GF correlations.ipynb"
%run "../Functions/Plot.ipynb"
### Online 1.52.2
#gfdf = gfdfWebgl1522PretestPosttestUniqueProfilesVolunteers.copy()
#rmdf = rmdfWebgl1522PretestPosttestUniqueProfilesVolunteers.copy()
### Playtest
#gfdf = gfdfPlaytestTotalPretestPosttestUn... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Sample selection
Step2: 1. Google form analysis
Step3: formatted version for nice display
Step4: 1.1 complete sample
Step5: 1.2 Per temporal... |
812 | <ASSISTANT_TASK:>
Python Code:
from google.cloud import bigquery
PROJECT = !gcloud config get-value project
PROJECT = PROJECT[0]
%env PROJECT=$PROJECT
%%bigquery --project $PROJECT
#standardSQL
SELECT
*
FROM
`nyc-tlc.yellow.trips`
WHERE
RAND() < .0000001 -- sample a small fraction of the data
%%bigquery -... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: View data schema and size
Step2: Preview data (alternate way)
Step4: Load sample into Pandas dataframe
Step5: Explore datafame
Step6: The Py... |
813 | <ASSISTANT_TASK:>
Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Guia inicial de TensorFlow 2.0 para principiantes
Step2: Carga y prepara el conjunto de datos MNIST. Convierte los ejemplos de numeros enteros ... |
814 | <ASSISTANT_TASK:>
Python Code:
import warnings
warnings.filterwarnings("ignore")
import os
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
from landlab.components import FlowDirectorSteepest, NetworkSedimentTransporter
from landlab.data_record import DataRecord
from landlab.grid.ne... | <SYSTEM_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. Load a shapefile that represents the river network
Step2: Alright, let's see what fields we read in with this shapefile
Step3: Great! Looks... |
815 | <ASSISTANT_TASK:>
Python Code:
# Add the vampyre path to the system path
import os
import sys
vp_path = os.path.abspath('../../')
if not vp_path in sys.path:
sys.path.append(vp_path)
import vampyre as vp
# Load the other packages
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inlin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Generating Synthetic Data
Step2: Next, simliar to the sparse linear inverse demo, we create Bernoull-Gaussian data.
Step3: Now, we create a ra... |
816 | <ASSISTANT_TASK:>
Python Code:
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD Style.
import os.path as op
import nibabel
from nilearn.plotting import plot_glass_brain
import numpy as np
import mne
from mne.channels import compute_native_head_t, read_custom_montage
from mne.viz import plot_alignment
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Prerequisites
Step2: Visualizing the MRI
Step3: Getting our MRI voxel EEG locations to head (and MRI surface RAS) coords
Step4: We can then g... |
817 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import (make_inverse_operator, apply_inverse,
write_inverse_operator)
mne.set_log_level('WARNING')
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Process MEG data
Step2: Compute the evoked response
Step3: Inverse modeling
|
818 | <ASSISTANT_TASK:>
Python Code:
ball = Mesh(geometry=SphereGeometry(radius=1), material=LambertMaterial(color='red'), position=[2,1,0])
scene = Scene(children=[ball, AmbientLight(color=0x777777), make_text('Hello World!', height=.6)])
c = PerspectiveCamera(position=[0,5,5], up=[0,0,1], children=[DirectionalLight(color='... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Clickable Surface
Step2: Design our own texture
Step3: Lines
Step4: Camera
Step6: Parametric Functions
|
819 | <ASSISTANT_TASK:>
Python Code:
import matplotlib
import pandas as pd
%matplotlib inline
import nsfg
df = nsfg.ReadFemPreg()
df.head()
pregordr = df['pregordr']
pregordr[2:5]
birthord_counts = df.birthord.value_counts().sort_index()
birthord_counts
birthord_counts.plot(kind='bar')
df['prglngth_cut'] = pd.cut(df.prg... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: DataFrames
Step2: Exercise 1
Step3: Print value counts for <tt>prglngth</tt> and compare to results published in the codebook
Step4: Compute ... |
820 | <ASSISTANT_TASK:>
Python Code:
from functions import connect, touch, light, sound, ultrasonic, disconnect
connect(12)
touch() # Per a executar repetidament, useu Ctrl + Enter
light() # Per a executar repetidament, useu Ctrl + Enter
sound() # Per a executar repetidament, useu Ctrl + Enter
ultrasonic() # Per a execut... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Sensor de tacte
Step2: Sensor de llum
Step3: Sensor de so (micròfon)
Step4: Sensor ultrasònic
Step5: <img src="img/interrupt.png" align="rig... |
821 | <ASSISTANT_TASK:>
Python Code:
# import and check version
import tensorflow as tf
# tf can be really verbose
tf.logging.set_verbosity(tf.logging.ERROR)
print(tf.__version__)
# a small sanity check, does tf seem to work ok?
hello = tf.constant('Hello TF!')
sess = tf.Session()
print(sess.run(hello))
sess.close()
x = tf... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Reading in data sets
Step2: Layers
Step3: Feature columns
|
822 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
# Tells the system to plot in-line, only necessary for iPython notebooks,
# not regular command-line python
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
import time
# Now that we have our packages, we need data. The file 'make_2d_data.py' wil... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: If we want to use our shiny python scripts, we'll need to import them too.
Step2: If we want a quick man-page style summary, we can call help(s... |
823 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib import cm, colors
import numpy as np
from ipywidgets import interact
plt.rcParams['figure.figsize'] = 16, 8
import sys
sys.path.append('../..')
from crocodile.simulate import *
from crocodile.synthesis import *
from util.v... | <SYSTEM_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. Expected
|
824 | <ASSISTANT_TASK:>
Python Code:
BERT_MODEL = 'bert-base-uncased'
BATCH_SIZE = 16 if "base" in BERT_MODEL else 2
GRADIENT_ACCUMULATION_STEPS = 1 if "base" in BERT_MODEL else 8
MAX_SEQ_LENGTH = 100
PREFIX = "junkfood_but"
import sys
sys.path.append('../')
import ndjson
import glob
from quillnlp.models.bert.preprocessing ... | <SYSTEM_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: Model
Step3: Training
Step4: Evaluation
|
825 | <ASSISTANT_TASK:>
Python Code:
DON'T MODIFY ANYTHING IN THIS CELL
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
view_sentence_range = (0, 10)
DON'T MODIFY AN... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Language Translation
Step3: Explore the Data
Step6: Implement Preprocessing Function
Step8: Preprocess all the data and save it
Step10: Chec... |
826 | <ASSISTANT_TASK:>
Python Code:
import requests
data = requests.get('http://localhost:5000/lakes').json()
print(len(data), "lakes")
for item in data[:10]:
print(item['name'], "- elevation:", item['elevation'], "m / area:", item['area'], "km^2 / type:", item['type'])
import requests
data = requests.get('http://local... | <SYSTEM_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 set #2
Step2: Problem set #3
Step3: Problem set #4
Step4: Problem set #5
Step5: Specifying a field other than name, area or elevatio... |
827 | <ASSISTANT_TASK:>
Python Code:
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input t... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Run the Demo
Step2: Video
Step3: Audio
Step4: Advanced options
|
828 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import sympy
sympy.init_printing() # pretty printing
# must define symbolic variables before us
x, y = sympy.symbols('x y', real=True)
y = x**2*sympy.sqrt(3*x-2)/(x+1)**2
y # This causes it to output formatted nicely.
# Taking the natural log of this:
a = sympy.ln(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: We first try to solve a complicated problem
Step2: Lets transform the left hand side in teh same way
Step3: We can simplify this as well and j... |
829 | <ASSISTANT_TASK:>
Python Code:
#!pip install graphistry -q
#!pip install OTXv2 -q
import graphistry
import pandas as pd
from OTXv2 import OTXv2, IndicatorTypes
from gotx import G_OTX
# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...', password='...', protocol='https', server='hu... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Start
Step2: Continue
|
830 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import sklearn.datasets, sklearn.linear_model, sklearn.neighbors
import sklearn.manifold, sklearn.cluster
import matplotlib.pyplot as plt
import seaborn as sns
import sys, os, time
import scipy.io.wavfile, scipy.signal
import pymc as mc
import cv2
%matplotlib inline
imp... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Topic purpose
Step2: Probability theory and Bayesian inference
Step3: Integration over the evidence
Step4: A simple mixture model
Step5: Pra... |
831 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from scipy.stats import dirichlet
import matplotlib.tri as tri
from matplotlib import cm
corners = np.array([[0, 0], [1, 0], [0.5, 0.75**0.5]])
triangle = tri.Triangulation(corner... | <SYSTEM_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: ${\alpha_k}=1$的情形:
Step3: ${\alpha_k}=0.1$的情形:
|
832 | <ASSISTANT_TASK:>
Python Code:
from __future__ import print_function
import numpy as np
author = "kyubyong. https://github.com/Kyubyong/numpy_exercises"
np.__version__
x1 = np.array(['Hello', 'Say'], dtype=np.str)
x2 = np.array([' world', ' something'], dtype=np.str)
out = np.char.add(x1, x2)
print(out)
x = np.array(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Q1. Concatenate x1 and x2.
Step2: Q2. Repeat x three time element-wise.
Step3: Q3-1. Capitalize the first letter of x element-wise.<br/>
Step4... |
833 | <ASSISTANT_TASK:>
Python Code:
%pylab inline
import urllib
# Only execute this if you want to regenerate the downloaded file
open("data/co2_mm_mlo.txt", "wb").write(urllib.request.urlopen("ftp://ftp.cmdl.noaa.gov/ccg/co2/trends/co2_mm_mlo.txt").read())
D = loadtxt("data/co2_mm_mlo.txt")
years = D[:, 2]
average = 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: Let's fetch the raw data of $CO_2$ measurements at Mauna Loa from the noaa.gov website
Step2: As explained in the file co2_mm_mlo.txt, the aver... |
834 | <ASSISTANT_TASK:>
Python Code:
##### Configuration #####
# Configure the filename
filename = "file.txt"
# Configure the path to input directory
input_path = "C:\Users\USERNAME\Desktop\we1s-test\input"
# input_path = "/Users/USERNAME/Desktop/we1s-test/input"
# Configure the path to output directory
output_path = "C:\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: Now you are ready to run the main part of the code. Click on the cell below and then type Shift+Enter. If you do not get an error, you should re... |
835 | <ASSISTANT_TASK:>
Python Code:
# For use in Quantopian Research, exploring interactively
from quantopian.interactive.data.quandl import cboe_vix as dataset
# import data operations
from odo import odo
# import other libraries we will use
import pandas as pd
# Let's use blaze to understand the data a bit using Blaze dsh... | <SYSTEM_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 go over the columns
Step2: <a id='pipeline'></a>
Step3: Now that we've imported the data, let's take a look at which fields are availabl... |
836 | <ASSISTANT_TASK:>
Python Code:
__copyright__ = "Zentrum für nachhaltige Energiesysteme Flensburg"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
__author__ = "wolfbunke"
import requests
import pandas as pd
fro... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Tutorial - How to work with the OpenEnergy Platform (OEP)
Step2: 1. Select data
Step3: <div class="alert alert-block alert-info">
Step4: 3. M... |
837 | <ASSISTANT_TASK:>
Python Code:
filename='semeval2013-task7/semeval2013-Task7-5way/beetle/train/Core/FaultFinding-BULB_C_VOLTAGE_EXPLAIN_WHY1.xml'
import pandas as pd
from xml.etree import ElementTree as ET
tree=ET.parse(filename)
r=tree.getroot()
from string import punctuation
def to_tokens(textIn):
'''Convert th... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: It's an xml file, so we'll need the xml.etree parser, and pandas so that we can import into a dataframe
Step2: Now, the reference answers are i... |
838 | <ASSISTANT_TASK:>
Python Code:
import random
import numpy as np
sampleCount = 100000 # total events in our simulation
p = 0.03 # ethernet frame loss probability
grpSize = 4 # packet count per datagram, 5000 by... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: There you see! Even a 3% ethernet frame loss translates to 12% packet loss for jumbo ping test. This is same as what we observed. Does the math ... |
839 | <ASSISTANT_TASK:>
Python Code:
# Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt
# Load image as greyscale
image_gray = cv2.imread('images/plane_256x256.jpg', cv2.IMREAD_GRAYSCALE)
# Calculate median intensity
median_intensity = np.median(image_gray)
# Set thresholds to be one standard 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: Load image
Step2: Detect Edges
Step3: View Edges
|
840 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot
assert matplotlib.__version__>='1.5.1'
import numpy
assert numpy.__version__>='1.10.4'
# Show the plots inside the notebook.
%matplotlib inline
# Make the figures high-resolution.
%config InlineBackend.figure_format='retina'
# Various font sizes.
ticksFontSize=18... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Setup the matplotlib environment to make the plots look pretty.
Step2: Introduction
Step3: Analyse the ratio
Step4: Not very legible, right? ... |
841 | <ASSISTANT_TASK:>
Python Code:
def g(x):
resultado = - 0.1*x**4 - 0.15*x**3 - 0.5*x**2 - 0.25*x + 1.2
return resultado
def fx_adelante(f,x,h):
derivada = (f(x+h) - f(x))/h
return derivada
print('f\'(0.5) =', fx_adelante(g,0.5,0.25))
def fx_atras(f,x,h):
derivada = (f(x) - f(x-h))/h
return deriv... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Primera diferencia hacia atrás
Step2: Primera diferencia centrada
Step3: Segunda diferencia hacia adelante
Step4: Segunda diferencia hacia at... |
842 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'awi-cm-1-0-hr', 'atmos')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "e... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
843 | <ASSISTANT_TASK:>
Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 사용자 정의 학습
Step2: 붓꽃 분류 문제
Step3: 데이터 탐색
Step4: 처음 5개의 데이터로부터 다음을 주목하세요.
Step5: 각각의 레이블은 "setosa"와 같은 문자형 이름과 연관되어있습니다. 하지만 머신러닝은 전형적으로 숫자형 값... |
844 | <ASSISTANT_TASK:>
Python Code:
import rebound
import reboundx
import numpy as np
sim = rebound.Simulation()
sim.G = 6.674e-11 # SI units
sim.dt = 1.e4 # Initial timestep in sec.
sim.N_active = 2 # Make it so dust particles don't interact with one another gravitationally
sim.add(m=1.99e30, hash="Sun") # add Sun with mas... | <SYSTEM_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 set up REBOUNDx and add radiation_forces. We also have to set the speed of light in the units we want to use.
Step2: By default, the... |
845 | <ASSISTANT_TASK:>
Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Keras の例による量子化認識トレーニング
Step2: 量子化認識トレーニングを使用せずに、MNIST のモデルをトレーニングする
Step3: 量子化認識トレーニングを使用して、事前トレーニング済みモデルをクローンおよびファインチューニングする
Step4: モデルをベースラ... |
846 | <ASSISTANT_TASK:>
Python Code:
# To visualize plots in the notebook
%matplotlib inline
# Imported libraries
#import csv
#import random
#import matplotlib
#import matplotlib.pyplot as plt
#import pylab
#import numpy as np
#from mpl_toolkits.mplot3d import Axes3D
#from sklearn.preprocessing import PolynomialFeatures
#fro... | <SYSTEM_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. Introduction
Step2: After being fitted, the model can then be used to predict new values
Step3: SVMs decision function depends on some subs... |
847 | <ASSISTANT_TASK:>
Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Working with tff's ClientData.
Step2: Manipulating a ClientData object
Step3: Inspecting the first dataset can tell us what type of examples a... |
848 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import pandas_datareader.data as web#株価など時系列データをwebから取得するパッケージ
from datetime import datetime
ticker = ['AMZN','FB','INTU']
start = '2012-01-01'#datetime(2016,1,1)
end = '2013-12-31'#datetime(2016,12,31)
df = web.DataReader(ticker,'google',start,end)[... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: NaNにする行と列の番号をランダムに生成する
Step2: 欠損値を確認
Step3: 欠損値を除外する
Step4: 欠損値を補間する
|
849 | <ASSISTANT_TASK:>
Python Code:
r = reaclib.Rate("reaclib-rates/c13-pg-n14-nacr")
print(r.original_source)
r.eval(1.e9)
print(r)
print(r.reactants)
print(r.products)
print(r.get_rate_exponent(2.e7))
r.plot()
print(r.ydot_string())
print(r.function_string())
files = ["c12-pg-n13-ls09",
"c13-pg-n14-nacr"... | <SYSTEM_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 original reaclib source
Step2: evaluate the rate at a given temperature (in K)
Step3: a human readable string describing the rate, and the... |
850 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
from scipy.stats import itemfreq
import matplotlib
import matplotlib.pyplot as plt
from scipy.io import loadmat
import pandas as pd
import seaborn as sns
from sklearn import cross_validation
from sklearn import svm
from sklearn.decomposition import PCA
%matplotlib inlin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Contacted cones per bipolar cell (Figure3B)
Step2: Contacted bipolar cells per cone (Figure 3D)
Step3: Total number of contacted BC per cone
S... |
851 | <ASSISTANT_TASK:>
Python Code:
# Nucleus is the only dependency we need to install. We need at least
# nucleus 0.5.0, since this was the first release of Nucleus that includes the
# visualization utilities we are using here.
%%capture
! pip install google-nucleus==0.5.1
# Nucleus may show an error about failing to buil... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Download a file of DeepVariant examples from Google Cloud Storage to the local file storage of this notebook. DeepVariant examples are stored in... |
852 | <ASSISTANT_TASK:>
Python Code:
import cobra
from cobra.flux_analysis import pfba
import pandas as pd # for nice tables
pd.set_option('display.max_colwidth', -1)
from utils import show_map
import escher
map_loc = './maps/e_coli_core.Core metabolism.json' # the escher map used below
from IPython.core.interactiveshell imp... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <span style="color
|
853 | <ASSISTANT_TASK:>
Python Code:
import numpy
y = numpy.linspace(0, 1, 20) ** 2
import toyplot
canvas, axes, mark = toyplot.plot(y, width=300)
canvas = toyplot.Canvas(width=300)
axes = canvas.axes()
axes.plot(y);
x = numpy.linspace(0, 2 * numpy.pi)
y = numpy.sin(x)
import toyplot.locator
canvas = toyplot.Canvas(width=6... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: ... or explicitly using
Step2: Properties
Step3: As a convenience, some of the most common properties can also be set when the axes are creat... |
854 | <ASSISTANT_TASK:>
Python Code:
from __future__ import print_function
import mxnet as mx
from mxnet import nd, autograd
import numpy as np
from collections import defaultdict
mx.random.seed(1)
# ctx = mx.gpu(0)
ctx = mx.cpu(0)
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
imp... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Dataset
Step2: Check the data real quick
Step3: Preparing the data for training
Step4: Long short-term memory (LSTM) RNNs
Step5: Attach the ... |
855 | <ASSISTANT_TASK:>
Python Code:
from auxi.tools.chemistry import stoichiometry
molarmass_FeO = stoichiometry.molar_mass("FeO")
molarmass_CO2 = stoichiometry.molar_mass("CO2")
molarmass_FeCr2O4 = stoichiometry.molar_mass("FeCr2O4")
print("Molar mass of FeO :", molarmass_FeO, "kg/kmol")
print("Molar mass of CO2 :",... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: An example is shown below with its output
Step2: Compact Approach
Step3: More Examples
Step4: Calculating Compound Amount
Step5: Compact App... |
856 | <ASSISTANT_TASK:>
Python Code:
# pymc3.distributions.DensityDist?
import matplotlib.pyplot as plt
import matplotlib as mpl
from pymc3 import Model, Normal, Slice
from pymc3 import sample
from pymc3 import traceplot
from pymc3.distributions import Interpolated
from theano import as_op
import theano.tensor as tt
import n... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Generating data
Step2: Model specification
Step3: For the sunspot model, the posterior distribution of αα is concentrated between 0.6 and 1.2,... |
857 | <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."
import nltk
s1Tokens = nltk.word_tokenize(sampleText1)
s1Tokens
len(s1Tokens)
s2Tokens = nl... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Tokens
Step2: 21 tokens extracted, which include words and punctuation.
Step3: And we can apply it to an entire book, "The Prince" by Machiave... |
858 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'inm-cm5-h', 'land')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "email"... | <SYSTEM_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... |
859 | <ASSISTANT_TASK:>
Python Code:
import hail as hl
hl.init()
from hail.plot import show
from pprint import pprint
hl.plot.output_notebook()
hl.utils.get_1kg('data/')
hl.import_vcf('data/1kg.vcf.bgz').write('data/1kg.mt', overwrite=True)
mt = hl.read_matrix_table('data/1kg.mt')
mt.rows().select().show(5)
mt.row_key.... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: If the above cell ran without error, we're ready to go!
Step2: Download public 1000 Genomes data
Step3: Importing data from VCF
Step4: Next ... |
860 | <ASSISTANT_TASK:>
Python Code:
!pip install --quiet --upgrade --force-reinstall tensorflow==2.4 tensorflow_probability==0.12.1 tensorflow-io==0.17.0 --use-feature=2020-resolver
!pip install tf_agents==0.7.1 --quiet gast==0.3.3 --upgrade --use-feature=2020-resolver
import functools
import os
from absl import app
from ab... | <SYSTEM_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. Initializing and configuring the MovieLens Environment
Step2: 3. Initializing the Agent
Step3: 4. Define and link the evaluation metrics
St... |
861 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
# Grab data
# Faster alternative
# df = pd.read_csv('time_data/walmart_stock.csv',index_col='Date')
df = pd.read_csv('time_data/walmart_stock.csv')
df.head()
df['Date'] = df['Date'].apply(pd.to_date... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Create a date index from the date column
Step2: resample()
Step3: You need to call resample with the rule parameter, then you need to call som... |
862 | <ASSISTANT_TASK:>
Python Code:
import csv
sentiment_csv = ""
def feature_extractor(word):
last_l = word[-1]
first_l = word[0]
return { 'first_letter' : first_l, 'last_letter' : last_l}
def main():
i_word = input("Enter the word ").lower()
features = feature_extractor(i_word)
print(features)... | <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: 1.2 Training the ML algorithm
Step 1
Step6: Step 2
Step9: Step 3
Step12: Step 4
Step13: Excercise
|
863 | <ASSISTANT_TASK:>
Python Code:
# Load training file to get vocabulary
text_file = 'biblia.txt' # input file
with codecs.open(text_file, 'r', 'utf-8') as f:
data = f.read()
chars = list(set(data))
vocab_size = len(chars)
char_to_ix = {ch: i for i, ch in enumerate(chars)}
ix_to_char = {i: ch for i, ch in enumera... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Training data
Step2: Network architecture
Step3: Connect the layers
Step4: Load parameters and build Theano graph
Step5: <img src="theano_gr... |
864 | <ASSISTANT_TASK:>
Python Code:
dado = np.array([5, 3, 3, 2, 5, 1, 2, 3, 6, 2, 1, 3, 6, 6, 2, 2, 5, 6, 4, 2, 1, 3, 4, 2, 2, 5, 3, 3,
2, 2, 2, 1, 6, 2, 2, 6, 1, 3, 3, 3, 4, 4, 6, 6, 1, 2, 2, 6, 1, 4, 2, 5, 3, 6, 6, 3,
5, 2, 2, 4, 2, 2, 4, 4, 3, 3, 1, 2, 6, 1, 3, 3, 5, 4, 6, 6, 4, 2, 5, 6,... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: PARA RECORDAR
Step2: Usando la función binom de python podemos graficar la función de distribución binomial para este caso.
Step3: $\textbf{FI... |
865 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from shogun import StringCharFeatures, RAWBYTE, HashedDocDotFeatures, NGramTokenizer
doc_1 = "this is the first document"
doc_2 = "document classification introduction"
doc_3 = "a third document ab... | <SYSTEM_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 <a href="http
Step2: We will take some time off now to assign each document to a category, to ease our work later on. Since the two last do... |
866 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
df=pd.DataFrame(data=[[1,1,2,5],[1,3,4,1],[4,1,2,5],[5,1,4,9],[1,1,2,5]],columns=['val', 'col1','col2','3col'])
def g(df):
cols = list(df.filter(like='col'))
df['index_original'] = df.groupby(cols)[cols[0]].transform('idxmax')
for i in range(len(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:
|
867 | <ASSISTANT_TASK:>
Python Code:
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib
#%matplotlib inline
df = pd.read_excel('/Users/matt/projects/EPRV/data/missings2.xls', encoding='utf-8')
df.columns
df.loc[16:17]
#df['AgendaItem'].str.con... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Read the RegOnline output into a pandas DataFrame
Step2: Extract the Sunday Sessions
Step3: Let's create two new columns in our DataFrame
Step... |
868 | <ASSISTANT_TASK:>
Python Code:
#######################################################################
### Parte 2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from PIL import Image
# Importar imagen
imagen = Image.open('C:/Users/Data Mining/Documents/ITAM/Propedeutico/Alumnos/PropedeuticoData... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Probar la visualización con los primeris n vectores
Step2: Podemos ver como se puede reconstruir la imagen sin utilizar toda la información de ... |
869 | <ASSISTANT_TASK:>
Python Code:
from pandas import read_excel, read_csv, DataFrame, Series, concat
from datetime import datetime
from codecs import open
from re import compile
from json import dumps
from datetime import datetime
from random import sample
from collections import Counter
from itertools import combinations... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Dan lezen we lezen de gegevens in
Step2: Samenbrengen en voorbereiden van de data
Step3: Voor de tentoonstellingen moeten we ook nog inperken ... |
870 | <ASSISTANT_TASK:>
Python Code:
%load_ext autoreload
%autoreload 2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tabulate
import pprint
import click
import numpy as np
import pandas as pd
from ray.tune.commands import *
from nupi... | <SYSTEM_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 and check data
Step2: ## Analysis
Step3: Does improved weight pruning outperforms regular SET
Step4: No significant difference between t... |
871 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import random as rnd
import pandas as pd
import numpy as np
import time
import datetime
import calendar
# fix what is missing with the datetime/time/calendar package
def add_months(sourcedate,months):
month = sourcedate.month - 1 + 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: classes buyers and sellers
Step2: Construct the market
Step3: Observer
Step4: Example Market
Step5: run the model
Step6: Operations Researc... |
872 | <ASSISTANT_TASK:>
Python Code::
from keras.models import Sequential
from keras.layers import Dense
from sklearn.datasets import make_blobs
from sklearn.preprocessing import MinMaxScaler
from numpy import array
X, y = make_blobs(n_samples=100, centers=2, n_features=2, random_state=1)
scalar = MinMaxScaler()
scalar.fit(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:
|
873 | <ASSISTANT_TASK:>
Python Code:
def getSum(n , d ) :
sum = 0 ;
for i in range(n + 1 ) :
if(i % 10 == d ) :
sum += i
return sum
if __name__== "__main __":
n , d = 30 , 3
print(getSum(n , d ) )
<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:
|
874 | <ASSISTANT_TASK:>
Python Code:
# Imports
import numpy as np
import pandas as pd
import xarray as xr
# Special functions
# from scipy.special import sph_harm
import spherical_functions as sf
import quaternion
# Performance & benchmarking libraries
# from joblib import Memory
# import xyzpy as xyz
import numba as nb
# Ti... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Test N2 case
Step2: Reference results from GetCro
Step3: Test LF calculations (CG version)
Step4: With sym summation
|
875 | <ASSISTANT_TASK:>
Python Code:
# 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 License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Overview
Step2: Setup KFP Host
Step3: Setup Google Cloud Project
Step4: Setup Google Cloud Credentials
Step5: Upload your service account fi... |
876 | <ASSISTANT_TASK:>
Python Code:
class SGD:
def __init__(self, lr=0.01):
self.lr = lr
def update(self, params, grads):
for key in params.keys():
params[key] -= self.lr * grads[key]
# cf.http://d.hatena.ne.jp/white_wheels/20100327/p3
import numpy as np
import matplotlib.pylab ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 6.1.3 SGDの欠点
Step2: 6.1.4 Momentum
Step3: 6.1.5 AdaGrad
Step4: 6.1.6 Adam
Step5: 6.1.7 どの更新手法を用いるか?
Step6: 上記ではAdaGradが一番良く見えるが、扱う問題やハイパーパラ... |
877 | <ASSISTANT_TASK:>
Python Code:
# Import Node and Function module
from nipype import Node, Function
# Create a small example function
def add_two(x_input):
return x_input + 2
# Create Node
addtwo = Node(Function(input_names=["x_input"],
output_names=["val_output"],
funct... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: As specified before, addtwo is the nodename, Node is the Nodetype, Function(...) is the interface_function and add_node is the labelname of the ... |
878 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-3', 'atmoschem')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "e... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
879 | <ASSISTANT_TASK:>
Python Code:
# http://onlinelibrary.wiley.com/doi/10.1002/2016JA022652/epdf
import pymc3
import tqdm
from pprint import pprint
import numpy as np
import matplotlib.pyplot as plt
import spacepy.plot as spp
import seaborn as sns
sns.set(font_scale=1.5)
# min_Dst, min_L
data = np.asarray([
65.000, 3.800... | <SYSTEM_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 delivered by Geoff Reeves 9/6/2016
Step2: Oberved Data
Step3: Make diagnostic plots of the posteriour distributions as created using MCMC... |
880 | <ASSISTANT_TASK:>
Python Code::
from keras.models import Sequential
from keras.layers import Dense
from sklearn.datasets import make_regression
from sklearn.preprocessing import MinMaxScaler
from numpy import array
X, y = make_regression(n_samples=100, n_features=2, noise=0.1, random_state=1)
scalarX, scalarY = MinMaxS... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
|
881 | <ASSISTANT_TASK:>
Python Code:
#All imports here
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import preprocessing
from datetime import datetime
from dateutil import relativedelta
%matplotlib inline
#Let's start by importing our csv files into dataframes
df_companies = pd.read_csv... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Start main dataset by USA companies from companies.csv
Step2: Extract company category features
Step3: Since there are too many categories, we... |
882 | <ASSISTANT_TASK:>
Python Code:
# Imports
import numpy as np
import gurobipy as gbp
import datetime as dt
# Constants
Aij = np.random.randint(5, 50, 250000)
Aij = Aij.reshape(500,500)
AijSum = np.sum(Aij)
Cj = np.random.randint(10, 20, 500)
CjSum = np.sum(Cj)
Bi = np.random.randint(10, 20, 500)
BiSum = np.sum(Bi)
# 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: <font size='7' face='Times New Roman'><b>1. <u>Primal</u></b></font>
Step2: <font size='7' face='Times New Roman'><b>2. <u>Dual</u></b></font>
|
883 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import Hodograph, SkewT
from metpy.units import units
col_names = ['press... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Getting Data
Step2: Thermodynamic Calculations
Step3: Basic Skew-T Plotting
Step4: Advanced Skew-T Plotting
Step5: Adding a Hodograph
|
884 | <ASSISTANT_TASK:>
Python Code:
n_trials = 1000 # number of trials (i.e., number of walks)
n_steps = 1000 # number of steps taken during each trial
distances = [] # use this to keep track of distance for each trial
this_trial = 0
# loop over trials
while this_trial < n_trials:
# reset step and distance to zero
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 2D random walk
Step2: asymmetric random walk
|
885 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import openpnm as op
import matplotlib.pyplot as plt
import openpnm.models as mods
%matplotlib inline
np.random.seed(10)
Lc = 40.5e-6
# 1. Set up network
sgl = op.network.Cubic(shape=[26, 26, 10], spacing=Lc, name='SGL10BA')
sgl.add_boundary_pores()
proj = sgl.project
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Setting up Network and Geometry
Step2: Before we move on to setting up our fluid and physics objects, we must constrict throats in the z and y ... |
886 | <ASSISTANT_TASK:>
Python Code:
class RecordingMeasurement:
A representation of a vehicle's state at a point in time while driving
around a track during recording.
Features available are:
left_camera_view - An image taken by the LEFT camera.
center_camera_view - An image tak... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step5: Training data was collected in the Self-Driving Car simulator on Mac OS using a Playstation 3 console controller.
Step7: Image Preprocessor
Ste... |
887 | <ASSISTANT_TASK:>
Python Code:
from __future__ import print_function
import numpy as np
from astropy import units
from matplotlib import pyplot as plt
%matplotlib inline
from clusterlensing import ClusterEnsemble
z = [0.1,0.2,0.3]
c = ClusterEnsemble(z)
c.describe
c.show()
n200 = np.ones(3)*20.
c.n200 = n200
c.show(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Create a ClusterEnsemble object by passing in a numpy array (or list) of redshifts
Step2: Display what we have so far
Step3: Add richness valu... |
888 | <ASSISTANT_TASK:>
Python Code:
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
#reading in an image
image = mpimg.imread('test_images/solidWhiteRight.jpg')
#printing out some stats and plotting
print('This image is:', typ... | <SYSTEM_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 an Image
Step9: Ideas for Lane Detection Pipeline
Step10: Test Images
Step11: Build a Lane Finding Pipeline
Step12: Test on Videos
S... |
889 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
# Define C=B*A in a symbolic way
A = tf.Variable(tf.ones([10]))
B = tf.constant(np.ones(10)*2, tf.float32)
C = tf.multiply(A, B)
init = tf.global_variables_initializer()
# Launch the graph
with ... | <SYSTEM_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 familiar with the following basic tensorflow methods
Step2: Linear Regression example
|
890 | <ASSISTANT_TASK:>
Python Code:
import pymatgen as mg
si = mg.Element("Si")
print("Atomic mass of Si is {}".format(si.atomic_mass))
print("Si has a melting point of {}".format(si.melting_point))
print("Ionic radii for Si: {}".format(si.ionic_radii))
print("Atomic mass of Si in kg: {}".format(si.atomic_mass.to("kg")))
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Basic Element, Specie and Composition objects
Step2: You can see that units are printed for atomic masses and ionic radii. Pymatgen comes with ... |
891 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
data_path = 'Bike-Sharing-Dataset/hour.csv'
rides = pd.read_csv(data_path)
rides.head()
rides[:24*10].plot(x='dteday', y='cnt')
dummy_fields = ['seas... | <SYSTEM_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 and prepare the data
Step2: Checking out the data
Step3: Dummy variables
Step4: Scaling target variables
Step5: Splitting the data into... |
892 | <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: Install Analytics Zoo
Step3: Distributed TensorFlow (v1.15) using Orca APIs
Step4: Step 1
Step5: This is the ... |
893 | <ASSISTANT_TASK:>
Python Code:
@description: Method to split a song into multiple songs using overlapping windows
def splitsongs(X, y, window = 0.05, overlap = 0.5):
# Empty lists to hold our results
temp_X = []
temp_y = []
# Get the input song array size
xshape = X.shape[0]
chunk = int(xshape*w... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Read the data
Step3: GTZAN Melspectrogram Generator
Step4: Custom CNN (Melspectrogram version)
Step6: Loss function
Step7: Majority Vote
Ste... |
894 | <ASSISTANT_TASK:>
Python Code:
import tensorflow as tf
# Check that GPU is available: cf. https://colab.research.google.com/notebooks/gpu.ipynb
assert(tf.test.is_gpu_available())
tf.keras.backend.clear_session()
tf.config.optimizer.set_jit(False) # Start with XLA disabled.
def load_data():
(x_train, y_train), (x_test... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: We define the model, adapted from the Keras CIFAR-10 example
Step2: We train the model using the
Step3: Now let's train the model again, using... |
895 | <ASSISTANT_TASK:>
Python Code:
def deco(func):
def wrapped():
print('Before func')
func()
print('After func')
return wrapped
@deco
def f1():
print('This is f1 function')
f1()
def deco(func):
def wrapped():
print('Before func')
func()
print('After func')
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Problem 1
Step2: Solution 1
Step3: Supplement
Step4: Decorator with argument
Step5: Decorator assignment
Step6: Decorator assignment (2)
S... |
896 | <ASSISTANT_TASK:>
Python Code:
import logging # python logging module
# basic format for logging
logFormat = "%(asctime)s - [%(levelname)s] (%(funcName)s:%(lineno)d) %(message)s"
# logs will be stored in tweepy.log
logging.basicConfig(filename='tweepy.log', level=logging.INFO,
format=logFormat, date... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Authentication and Authorisation
Step3: Post this step, we will have full access to twitter api's
Step9: Streaming with tweepy
Step12: Drawba... |
897 | <ASSISTANT_TASK:>
Python Code:
from __future__ import print_function, unicode_literals
from axon.api import loads, dumps
from IPython.display import HTML, display
text =
graph {
nodes: [
&1 node {x:1 y:1}
&2 node {x:1 y:2}
&3 node {x:2 y:2}
]
edges: [
edge {*1 *2}
e... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Simple graph example
Step3: Bellow we define Graph, Node, Edge classes.
Step4: Then we define and register reduce/factory for dumping/loading.... |
898 | <ASSISTANT_TASK:>
Python Code:
%%capture
!curl -L https://github.com/tensorflow/privacy/releases/download/0.2.3/order.tgz -o order.tgz
!tar zxvf order.tgz
mnist_priv_train = np.load('data/order_mnist_priv_train.npy')
mnist_priv_test = np.load('data/order_mnist_priv_test.npy')
mnist_priv_train.shape
(x_train, y_train), ... | <SYSTEM_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 top and bottom "3" digits
Step2: UMAP
|
899 | <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
N = 12
X = torch.rand(N,1).double()
Y = (torch.sin(12*X) + 0.6*... | <SYSTEM_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 have a regression example
Step2: Creating the model
Step3: Maximum-A-Posteriori
Step4: Hamiltonian Monte Carlo
Step5: Plotting simulat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.