Unnamed: 0 int64 0 15.9k | cleaned_code stringlengths 67 124k ⌀ | cleaned_prompt stringlengths 168 30.3k ⌀ |
|---|---|---|
1,600 | <ASSISTANT_TASK:>
Python Code:
ssh-keygen -t rsa -b 4096 -C "fyuewen@hotmail.com"
ssh-add ~/.ssh/id_rsa_pycharm-git
ssh-add -l # to ensure the key is added
<END_TASK> | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: I named the private key file to be 'id_rsa_pycharm-git', corerspondingly it's public key would be 'id_rsa_pycharm-git.pub'.
|
1,601 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
plt.rcParams['figure.figsize'] = (20.0, 10.0)
plt.rcParams['font.family'] = "serif"
df = pd.read_csv('../../../datasets/movie_metadata.csv')
df.head()
# split each movie's genr... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: For the bar plot, let's look at the number of movies in each category, allowing each movie to be counted more than once.
Step2: Basic plot
Step... |
1,602 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot as plt
%matplotlib inline
import nengo
import numpy as np
import scipy.ndimage
import matplotlib.animation as animation
from matplotlib import pylab
from PIL import Image
import nengo.spa as spa
import cPickle
import random
from nengo_extras.data import load_mnist... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Represent each number using a one-hot where the index of the one represents the digit value
Step2: Load the MNIST training and testing images
S... |
1,603 | <ASSISTANT_TASK:>
Python Code:
from pymatgen.electronic_structure.plotter import CohpPlotter
from pymatgen.electronic_structure.cohp import CompleteCohp
%matplotlib inline
COHPCAR_path = "lobster_data/GaAs/COHPCAR.lobster"
POSCAR_path = "lobster_data/GaAs/POSCAR"
completecohp=CompleteCohp.from_file(fmt="LOBSTER",file... | <SYSTEM_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 a completecohp object to simplify the plotting
Step2: plot certain COHP
Step3: add several COHPs
Step4: focus on certain orbitals only
St... |
1,604 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
np.random.seed(4242)
n_samples = 500
n_features = 2
X1 = np.random.rand(n_samples, n_features)
y1 = np.ones((n_samples, 1))
idx_neg = (X1[:, 0] - 0.5) ** 2 + (X1[:, 1] - 0.5) ** 2 < 0.03
y1[idx_neg] = 0
import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figs... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Exercise 1
Step2: Code up your own SVM solution below
Step3: Code up your own SVM solution below
Step4: Code up your own solution
|
1,605 | <ASSISTANT_TASK:>
Python Code:
# to generate gifs
!pip install imageio
from __future__ import absolute_import, division, print_function
# Import TensorFlow >= 1.9 and enable eager execution
import tensorflow as tf
tfe = tf.contrib.eager
tf.enable_eager_execution()
import os
import time
import numpy as np
import glob
i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Import TensorFlow and enable Eager execution
Step2: Load the MNIST dataset
Step3: Use tf.data to create batches and shuffle the dataset
Step4:... |
1,606 | <ASSISTANT_TASK:>
Python Code:
# tensorflow
import tensorflow as tf
# rnn common functions
from tensorflow.contrib.learn.python.learn.estimators import rnn_common
# visualization
import seaborn as sns
import matplotlib.pyplot as plt
# helpers
import numpy as np
import pandas as pd
import csv
# enable tensorflow logs
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: Describing the data set and the model
Step2: Separating training, evaluation and a small test data
Step3: What we want to predict
Step4: Defi... |
1,607 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import time
import numpy as np
import matplotlib.pyplot as plt
import tridesclous as tdc
from tridesclous import DataIO, CatalogueConstructor, Peeler
#download dataset
localdir, filenames, params = tdc.download_dataset(name='locust')
print(filenames)
print(params)
#cr... | <SYSTEM_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 small dataset
Step2: DataIO = define datasource and working dir
Step3: CatalogueConstructor
Step4: Set some parameters
Step5: Est... |
1,608 | <ASSISTANT_TASK:>
Python Code:
from lsst.cwfs.instrument import Instrument
from lsst.cwfs.algorithm import Algorithm
from lsst.cwfs.image import Image, readFile, aperture2image, showProjection
import lsst.cwfs.plots as plots
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
fieldXY = [0,0]
I1 = Ima... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Define the image objects. Input arguments
Step2: Define the instrument. Input arguments
Step3: Define the algorithm being used. Input argument... |
1,609 | <ASSISTANT_TASK:>
Python Code:
# NumPy is the fundamental package for scientific computing with Python.
import numpy as np
def theta_init(in_size, out_size, epsilon = 0.12):
return np.random.rand(in_size + 1, out_size) * 2 * epsilon - epsilon
def sigmoid(x):
return np.divide(1.0, (1.0 + np.exp(-x)))
def sigmo... | <SYSTEM_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 theta_init function is used to initialize the thetas (weights) in the network. It returns a random matrix with values in the range of [-epsi... |
1,610 | <ASSISTANT_TASK:>
Python Code:
def NFW_escape_vel(r, Mvir, Rvir, CvirorRs, truncated=False):
NFW profile escape velocity
Parameters
----------
r : Quantity w/ length units
Radial distance at which to compute the escape velocity
Mvir : Quantity w/ mass units
Virial Mass
Cviro... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Function to compute escape velocity given halo parameters
Step3: Functions to compute halo parameters given cosmology and Mvir
Step6: Use thes... |
1,611 | <ASSISTANT_TASK:>
Python Code:
import os
import numpy as np
def parseRDD(point):
Parser for the current dataset. It receives a data point and return
a sentence (third field).
Args:
point (str): input data point
Returns:
str: a string
data = point.split('\t')
return ... | <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: Lab 5b - k-Means para Quantização de Atributos
Step4: Parte 1
Step5: (1b) Aplicando transformação word2vec
Step6: (1c) Gerando uma RDD de mat... |
1,612 | <ASSISTANT_TASK:>
Python Code:
import skotree
skotree.VERSION
# this load the library
import skotree
# this load the experiment located
# in the directory tests and
experiment = skotree.oTree("./tests")
experiment
experiment.settings
experiment.lsapps()
experiment.lssessions()
experiment.session_config("matching_p... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Philosophy
Step2: The previous code make a lot of things in background
Step3: This is the traditional object that you
Step4: or maybe you wan... |
1,613 | <ASSISTANT_TASK:>
Python Code:
import math
from astropy import units as u
pixel_pitch = 5.4 * u.micron / u.pixel # STF-8300M pixel pitch
focal_length = 400 * u.millimeter # Canon EF 400 mm f/2.8L IS II USM focal length
resolution = (3326, 2504) * u.pixel # STF-8300M resolution in pixels, (x, y)
sampling = (pixel_pitc... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Each imaging unit shall deliver an on-sky spatial sampling of $2.8\pm 0.1'' /$ pixel
Step2: Each imaging unit shall deliver an instantaneous fi... |
1,614 | <ASSISTANT_TASK:>
Python Code:
import io
# The legacy way:
file = open('/tmp/some_integers_1.txt', 'w')
file.write('{}\n'.format(1))
file.write('{}\n'.format(2))
file.write('{}\n'.format(3))
file.close()
!cat /tmp/some_integers_1.txt
# The modern (pythonic) alternative:
with io.open('/tmp/some_integers_2.txt', 'w') as... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Write some integers
Step2: Reading the file
Step3: Opening modes
Step4: Persistence of objects (serialization) ... in disk
|
1,615 | <ASSISTANT_TASK:>
Python Code:
# code cell
name = "Jonathan"
import numpy as np
# don't do:
# from numpy import *
max("a")
np.max("a")
# %matplotlib inline
# %config InlineBackend.figure_format='retina'
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
from pivottablejs import pivot_... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Tips and Tricks
Step2: Imports
Step3: Keyboard shortcuts
Step4: Split a cell with -
Step5: Enhanced Pandas Dataframe Display
Step6: Tab -- ... |
1,616 | <ASSISTANT_TASK:>
Python Code:
from IPython.core.display import HTML
with open ("../style.css", "r") as file:
css = file.read()
HTML(css)
import ply.lex as lex
tokens = [
'NUMBER',
'PLUS',
'MINUS',
'TIMES',
'DIVIDE',
'LPAREN',
'RPAREN'
]
t_PLUS = r'\+'
t_MINUS = r'-'
t_TIMES = r'\*'
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: This example has been extracted from the official documentation of Ply.
Step2: We start with a definition of the <em style="color
Step3: There... |
1,617 | <ASSISTANT_TASK:>
Python Code::
import pandas as pd
from sklearn.model_selection import StratifiedKFold
df = pd.read_csv('data/raw/train.csv')
# initialise a StratifiedKFold object with 5 folds and
# declare the column that we which to group by which in this
# case is the column called "label"
skf = StratifiedKFold(n_s... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
|
1,618 | <ASSISTANT_TASK:>
Python Code:
def largest_smallest_integers(lst):
'''
Create a function that returns a tuple (a, b), where 'a' is
the largest of negative integers, and 'b' is the smallest
of positive integers in a list.
If there is no negative or positive integers, return them as None.
Examples... | <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,619 | <ASSISTANT_TASK:>
Python Code:
print "This is a python cell. It executes and its output renders below."
print "Running this cell next."
from IPython.display import Image
Image("https://pbs.twimg.com/media/CJsHH88UYAE0ewF.jpg")
from IPython.display import YouTubeVideo
YouTubeVideo("aIXED26Wppg")
Image("http://jupyte... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: You can do most anything here that you could do in the Python REPL, indeed this is basically a web front-end to the Python REPL, or more precise... |
1,620 | <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... |
1,621 | <ASSISTANT_TASK:>
Python Code:
print("This is the first line.")
print("This is the second line.")
print("This is the third line.")
print("Hello, world!")
print("This is the first line.")
print("This is the second line.")
print("This is the third line.")
print("This is the first line.")
print("This is the second line... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Označavanje sintakse bojama (syntax highlighting) u editoru Notepad++
Step2: Iz menija odaberite <i>Language</i> > <i>P</i> > <i>Python</i>. Pr... |
1,622 | <ASSISTANT_TASK:>
Python Code:
from pynq.overlays.base import BaseOverlay
base = BaseOverlay('base.bit')
%%microblaze base.PMODA
#include <i2c.h>
#include <pmod_grove.h>
int read_adc() {
i2c device = i2c_open(PMOD_G4_B, PMOD_G4_A);
unsigned char buf[2];
buf[0] = 0;
i2c_write(device, 0x50, buf, 1);
i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: We can use the gpio and timer components in concert to flash an LED connected to G1. The timer header provides PWM and program delay functionali... |
1,623 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-1', 'ocnbgchem')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
1,624 | <ASSISTANT_TASK:>
Python Code:
from sklearn.datasets import load_digits
digits = load_digits()
digits.images.shape
idx = 14
digits.target[idx], digits.images[idx]
import matplotlib.pyplot as plt
fig, axes = plt.subplots(10, 10, figsize=(8, 8),
subplot_kw={'xticks':[], 'yticks':[]},
... | <SYSTEM_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 a two-dimensional, [n_samples, n_features] representation. We can accomplish this by treating each pixel in the image as a feature.
Ste... |
1,625 | <ASSISTANT_TASK:>
Python Code:
# Measurement noise
noise_var = 0.05 ** 2
# Bounds on the inputs variable
bounds = [(-5., 5.), (-5., 5.)]
# Define Kernel
kernel = GPy.kern.RBF(input_dim=len(bounds), variance=2., lengthscale=1.0,
ARD=True)
# Initial safe point
x0 = np.zeros((1, len(bounds)))
# Gener... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Interactive run of the algorithm
|
1,626 | <ASSISTANT_TASK:>
Python Code:
df = pd.read_csv("../data/ign.csv")
print(df.info())
df = df.drop('title', axis=1)
df = df.drop('url', axis=1)
df = df.drop('Unnamed: 0', axis=1)
df = df.dropna()
print(df.info())
print(df.head())
from sklearn import preprocessing
le = preprocessing.LabelEncoder()
for col in df.columns.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: Encode parameters
Step2: Tips and objectives
|
1,627 | <ASSISTANT_TASK:>
Python Code:
# Integer data
type( 17 )
# Floating-point data
type( 17.0 )
# A number inside a string
type( '17' )
count = 55
size = 42.0
print( count )
type( count )
# Operator: + (addition)
# Operands: 3 and 4
3 + 4
# Operator: - (subtraction)
# Operands: 3 and 4
3 - 4
# Operator: *tiplication (m... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Variables
Step2: The print function displays the value of a variable
Step3: The type of a variable is the type of its value
Step4: Variable n... |
1,628 | <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: Quantum data
Step2: 1. Data preparation
Step3: Filter the dataset to keep just the T-shirts/tops and dresses, remove the other classes. At the... |
1,629 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.metric... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load the data
Step2: Add a Target Column
Step3: Perform the Train/Test Split
Step4: Create the Classifiers
Step5: Comparing the Classifiers
... |
1,630 | <ASSISTANT_TASK:>
Python Code:
# Setup your dependencies
import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
USER_FLAG = ""
# Google Cloud Notebook requires dependencies to be installed with '--user'
if IS_GOOGLE_CLO... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Install the latest version of the Vertex AI client library.
Step2: Install the Cloud Storage library
Step3: Restart the kernel
Step4: Set you... |
1,631 | <ASSISTANT_TASK:>
Python Code:
from prody import *
from pylab import *
%matplotlib inline
structure = parsePDB('mdm2.pdb')
structure
ensemble = parseDCD('mdm2.dcd')
ensemble.setCoords(structure)
ensemble.setAtoms(structure.calpha)
ensemble
ensemble.superpose()
eda_ensemble = EDA('MDM2 Ensemble')
eda_ensemble.buildCov... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Parse reference structure
Step2: EDA calculations
Step3: If you are analyzing a large trajectory, you can pass the trajectory instance to the ... |
1,632 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.interpolate import interp1d
with np.load('trajectory.npz') as work:
t=work['t']
x=work['x']
y=work['y']
assert isinstance(x, np.ndarray) and len(x)==40
assert isinstance(y, ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 2D trajectory interpolation
Step2: Use these arrays to create interpolated functions $x(t)$ and $y(t)$. Then use those functions to create the ... |
1,633 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'gfdl-cm4', 'atmoschem')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
1,634 | <ASSISTANT_TASK:>
Python Code:
import requests
import pandas as pd
import matplotlib.pylab as plt
import seaborn as sns
import numpy as np
import scipy.stats as ss
# For inline pictures
%matplotlib inline
sns.set_context('notebook')
# For nicer output of Pandas dataframes
pd.set_option('float_format', '{:8.2f}'.format)... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Import the data
Step2: Plot the data
Step3: Estimate the density
Step4: Kernels
Step5: Nadaraya-Watson (NW) or local constant estimator
Step... |
1,635 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
benchmark_data = pd.read_csv('sklearn-benchmark-data.tsv.gz', sep='\t')
benchmark_data.head()
benchmark_data.rename(columns={'heart-c':'Dataset_Name',
'GradientBoostingClassifier':'Method_Name',
'loss=expone... | <SYSTEM_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 all the method names
Step2: Store the data method wise separately
Step3: Save the data method wise to a folder in tsv.gz format
Step4: Sp... |
1,636 | <ASSISTANT_TASK:>
Python Code:
import numpy
from matplotlib import pyplot
%matplotlib inline
### generate some random data
xdata = numpy.arange(15)
ydata = numpy.random.randn(15) + xdata
### initialize the "figure" and "axes" objects
fig, ax = pyplot.subplots()
points_plot = ax.plot(xdata, ydata, marker='o')
### in... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Ok you got me, the plot function still generates a line by default... but we can turn it off
Step2: Markersize
Step3: Symbol
Step4: Errorbars... |
1,637 | <ASSISTANT_TASK:>
Python Code:
!pip install -q -U google-cloud-bigquery pyarrow
import os
from google.cloud import bigquery
PROJECT_ID = "yourProject" # Change to your project.
BUCKET = "yourBucketName" # Change to the bucket you created.
SQL_SCRIPTS_DIR = "sql_scripts"
BQ_DATASET_NAME = "recommendations"
!gcloud c... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Import libraries
Step2: Configure GCP environment settings
Step3: Authenticate your GCP account
Step4: Create the stored procedure dependenci... |
1,638 | <ASSISTANT_TASK:>
Python Code:
# setup
import numpy as np
import sympy as sp
import scipy
from pprint import pprint
sp.init_printing(use_latex='mathjax')
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (12, 8) # (width, height)
plt.rcParams['font.size'] = 14
plt.rcParams['legend.fontsize'] = 16
from ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Materials
|
1,639 | <ASSISTANT_TASK:>
Python Code:
import theano
import theano.tensor as T
k = T.iscalar('K')
a = T.vector('A')
i = T.vector('A')
result, updates = theano.scan(fn=lambda pre , k : pre*a ,
outputs_info = i,
non_sequences=a,
n_steps = k
)
print... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 撰寫一個 A 的 K 次計算函式
Step2: result 為用 tensor 來接
|
1,640 | <ASSISTANT_TASK:>
Python Code:
__author__ = 'Matt Wilber'
import sys
print(sys.version)
from abc import abstractmethod, ABC
class AbstractPouncer(ABC):
@abstractmethod
def pounce(self):
pass
class Fox(AbstractPouncer):
def pounce(self):
self.crouch()
self.leap()
... | <SYSTEM_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
Step3: Intro to @cachedproperty
Step5: Example of using both
Step7: For the sake of completeness, let's see an example of how these ... |
1,641 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-1', 'toplevel')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 2... |
1,642 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from astropy.modeling.functional_models import Const1D
from pyxel import Image, load_region
from pyxel.fitters import CstatFitter
from pyxel.models import IntMod... | <SYSTEM_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 are four Chandra observations of ZwCl 2341.1+0000. The fully processed images in the energy band 0.5-2 keV are available in the PyXel GitH... |
1,643 | <ASSISTANT_TASK:>
Python Code:
measurement_id = 0
windows = (60, 180)
# Cell inserted during automated execution.
windows = (30, 180)
measurement_id = 1
import time
from pathlib import Path
import pandas as pd
from scipy.stats import linregress
from scipy import optimize
from IPython.display import display
from fretbu... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Notebook arguments
Step2: Selecting a data file
Step3: Data load and Burst search
Step4: Compute background and burst search
Step5: Let's ta... |
1,644 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-2', 'land')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "emai... | <SYSTEM_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... |
1,645 | <ASSISTANT_TASK:>
Python Code:
target = 'stm32f415_tinyaes'
tf_cap_memory()
target_config = json.loads(open("config/" + target + '.json').read())
BATCH_SIZE = target_config['batch_size']
TRACE_LEN = target_config['max_trace_len']
available_models = get_models_by_attack_point(target_config)
DATASET_GLOB = "datasets/%s... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Available models
Step2: Dataset paths
Step3: Single byte recovery
Step4: Using our model to predicting bytes attack point value, recovering b... |
1,646 | <ASSISTANT_TASK:>
Python Code:
# Download the dataset in this directory (does that work on Windows OS ?)
! wget http://deeplearning.net/data/mnist/mnist.pkl.gz
import cPickle, gzip, numpy
import numpy as np
# Load the dataset
f = gzip.open('mnist.pkl.gz', 'rb')
train_set, valid_set, test_set = cPickle.load(f)
f.close()... | <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: You can now implement a 2 layers NN
Step5: 2 - Define Model
Step8: 3 - Define Derivatives
|
1,647 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
stats2 = pd.read_csv("lossStats_HUMAN.csv",index_col=0)
stats2.fillna({"mean":np.nan,"variance":np.nan,"outliers":0},inplace=True)
stats2.head()
ax = stats2["variance"].hist(bins=50,color='gre... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: False positives
Step2: Let's look at distribution of the mean and variance
Step3: Count number of outliers for each gene
Step4: Get number of... |
1,648 | <ASSISTANT_TASK:>
Python Code:
def areaSquare(side ) :
area = side * side
return area
side = 4
print(areaSquare(side ) )
<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:
|
1,649 | <ASSISTANT_TASK:>
Python Code:
import sqlite3 as db
disk_engine = db.connect ('NYC-311-2M.db')
import plotly.plotly as py
py.sign_in ('USERNAME', 'PASSWORD') # Connect!
import pandas as pd
import itertools
import time # To benchmark of these three solutions
import sys # for sys.stdout.flush ()
from plotly.graph_objs im... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step3: Solution 1
Step4: Solution 2
Step5: A nice feature of a view is that it is stored in the database and automatically kept up to date.
Step6: S... |
1,650 | <ASSISTANT_TASK:>
Python Code:
# change these to try this notebook out
BUCKET = 'cloud-training-demos-ml'
PROJECT = 'cloud-training-demos'
REGION = 'us-central1'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
%%bash
if ! gsutil ls | grep -q gs://${BUCKET}/; then
... | <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: <h2> Create ML dataset by sampling using BigQuery </h2>
Step3: There are only a limited number of years and months in the dataset. Let's see wh... |
1,651 | <ASSISTANT_TASK:>
Python Code:
# Set up matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import Image
Image(filename="ang_dist.png", width=500)
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
# In this case we just need to define the matter density
# and hubble ... | <SYSTEM_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 start with a cosmology object. We will make a flat cosmology (which means that the curvature density $\Omega_k=0$) with a hubble parameter o... |
1,652 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
from bokeh.plotting import figure, show, output_notebook
# Get data
df = pd.read_csv('data/Land_Ocean_Monthly_Anomaly_Average.csv')
# Process data
df['datetime'] = pd.to_datetime(df['datetime'])
df = df[['anomaly','datetime']]
df['moving_average'] = pd.rolling_mean(df[... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Exercise
Step2: Exercise
Step4: [OPTIONAL] Exercise
|
1,653 | <ASSISTANT_TASK:>
Python Code:
import os
import mdtraj
import mdtraj.reporters
from simtk import unit
import simtk.openmm as mm
from simtk.openmm import app
import mdtraj.testing
pdb = mdtraj.load(mdtraj.testing.get_fn('native.pdb'))
topology = pdb.topology.to_openmm()
forcefield = app.ForceField('amber99sbildn.xml'... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: And a few things froms OpenMM
Step2: First, lets find a PDB for alanine dipeptide, the system we'll
Step3: Lets use the amber99sb-ildn forcefi... |
1,654 | <ASSISTANT_TASK:>
Python Code:
import h5py, numpy
with h5py.File('../data/dataset.h5', 'r') as f:
features = f['features'][:, -32 * 32:]
import keras, \
keras.layers, \
keras.layers.core as core, \
keras.layers.convolutional as conv, \
keras.models as models
from keras import backen... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Now we'll build an autoencoder...
Step2: Okay, it's negative, but it looks good anyway. Let's check out the weights.
|
1,655 | <ASSISTANT_TASK:>
Python Code:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import numpy.ma as ma
import sys
sys.path.append("..")
from hiora_cartpole import interruptibility
import saveloaddata
import stats_experiments
import stats_experiments as se
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Results
Step2: Q-learning
Step4: Questions
Step5: Interesting
|
1,656 | <ASSISTANT_TASK:>
Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/s... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Set parameters
Step2: Show result
|
1,657 | <ASSISTANT_TASK:>
Python Code:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False)
DO NOT MODIFY THIS CELL
def fully_connected(prev_layer, num_units):
Create a fully connectd layer with the given layer... | <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: Batch Normalization using tf.layers.batch_normalization<a id="example_1"></a>
Step6: We'll use the following function to create convolutional l... |
1,658 | <ASSISTANT_TASK:>
Python Code:
pd.date_range(starting_date, periods=6)
pd.Series([1,2,3,4,5,6], index=pd.date_range(starting_date, periods=6))
sample_series = pd.Series([1,2,3,4,5,6], index=pd.date_range(starting_date, periods=6))
sample_df_2['Extra Data'] = sample_series *3 +1
sample_df_2
sample_df_2.at[dates_index[3... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Setting values by label
Step2: Setting values by position
Step3: Setting by assigning with a numpy array
|
1,659 | <ASSISTANT_TASK:>
Python Code:
%%capture
!pip install git+https://github.com/deepmind/dm-haiku
!pip install git+https://github.com/jamesvuc/jax-bayes
import haiku as hk
import jax.numpy as jnp
from jax.experimental import optimizers
import jax
import jax_bayes
import sys, os, math, time
import numpy as onp
import numpy... | <SYSTEM_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
Step3: Model
Step4: SGD
Step5: SGLD
Step6: Uncertainty analysis
Step7: SGD
Step9: SGLD
Step10: Distribution shift
Step11: SGD
Step1... |
1,660 | <ASSISTANT_TASK:>
Python Code:
#invite people for the Kaggle party
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import norm
from sklearn.preprocessing import StandardScaler
from scipy import stats
import warnings
warnings.filterwarnings('ignore')
%matplot... | <SYSTEM_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. So... What can we expect?
Step2: 'Very well... It seems that your minimum price is larger than zero. Excellent! You don't have one of those ... |
1,661 | <ASSISTANT_TASK:>
Python Code:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import spdiags
from scipy.sparse.linalg import lsqr as splsqr
from spgl1.lsqr import lsqr
from spgl1 import spgl1, s... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Lasso
Step2: Solve the underdetermined LASSO problem for $||x||_1 <= \pi$
Step3: BP
Step4: BPDN
Step5: BPDN with non-negative solution
Step6... |
1,662 | <ASSISTANT_TASK:>
Python Code:
from qutip import *
import matplotlib.pyplot as plt
import numpy as np
boundary_condition = "periodic"
cells = 3
Periodic_Atom_Chain = Lattice1d(num_cell=cells, boundary = boundary_condition)
Periodic_Atom_Chain
H = Periodic_Atom_Chain.display_unit_cell(label_on = True)
T = Periodic_At... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Declaring a tight binding chain with a single site unit cell
Step2: The user can call Periodic_Atom_Chain to print all its information.
Step3: ... |
1,663 | <ASSISTANT_TASK:>
Python Code:
from poppy.creatures import PoppyErgo
poppy = PoppyErgo()
for m in poppy.motors:
m.compliant = False
m.goal_position = 0.0
# Import everything you need for recording, playing, saving, and loading Moves
# Move: object used to represent a movement
# MoveRecorder: object used to rec... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Import the Move, Recorder and Player
Step2: Create a Recorder for the robot Poppy
Step3: Start the recording
Step4: Starts the recording when... |
1,664 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
%matplotlib inline
dataset = pd.read_csv('dataset.csv')
dataset.head(5)
dataset.count_total.describe()
#add a new column to create a binary class for room occupancy
countmed = dataset.count_total.median()
dataset['room_occupancy'] = dataset['count_total'].apply(lambda... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Feature Analysis
Step2: Rank2D
Step3: RadViz
Step4: For regression, the RadViz visualizer should use a color sequence to display the target i... |
1,665 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
import pandas as pd
import xarray as xr
import cartopy.crs as ccrs
from matplotlib import pyplot as plt
print("numpy version : ", np.__version__)
print("pandas version : ", pd.__version__)
print("xarray version : ", xr.__version__)
ds = xr.tutoria... | <SYSTEM_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 an example, consider this dataset from the xarray-data repository.
Step2: In this example, the logical coordinates are x and y, while the ph... |
1,666 | <ASSISTANT_TASK:>
Python Code:
print("Let's print a newline\nVery good. Now let us create a newline\n\twith a nested text!")
print('It\'s Friday, Friday\nGotta get down on Friday')
print("Oscar Wild once said: \"Be yourself; everyone else is already taken.\"")
print("The path of the document is C:\nadia\tofes161\adva... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <p style="text-align
Step2: <p style="text-align
Step3: <p style="text-align
Step5: <div class="align-center" style="display
Step6: <div cla... |
1,667 | <ASSISTANT_TASK:>
Python Code:
data_path = '/content/gdrive/My Drive/amld_data'
# Alternatively, you can also store the data in a local directory. This method
# will also work when running the notebook in Jupyter instead of Colab.
# data_path = './amld_data
if data_path.startswith('/content/gdrive/'):
from google.col... | <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: Get the data
Step5: Create your own group -- the more categories you include the more challenging the classification task will be...
Step6: In... |
1,668 | <ASSISTANT_TASK:>
Python Code:
# Load the network.
G = cf.load_physicians_network()
# Make a Circos plot of the graph
import numpy as np
from circos import CircosPlot
nodes = sorted(G.nodes())
edges = G.edges()
edgeprops = dict(alpha=0.1)
nodecolor = plt.cm.viridis(np.arange(len(nodes)) / len(nodes))
fig = plt.figure(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Question
Step3: In reality, NetworkX already has a function that counts the number of triangles that any given node is involved in. This is pro... |
1,669 | <ASSISTANT_TASK:>
Python Code:
__author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2022"
import os
from sklearn.metrics import classification_report
import torch
import torch.nn as nn
import transformers
from transformers import BertModel, BertTokenizer
from torch_shallow_neural_classifier import ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Contents
Step2: The transformers library does a lot of logging. To avoid ending up with a cluttered notebook, I am changing the logging level. ... |
1,670 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'sandbox-1', 'seaice')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "ema... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 2... |
1,671 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import importlib
import os, sys; sys.path.insert(1, os.path.join('../utils'))
from utils2 import *
import torch, torch.nn as nn, torch.nn.functional as F, torch.optim as optim
from torch.autograd import Variable
from torch.utils.serialization import load_lua
from torch.... | <SYSTEM_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
Step2: Create Model
|
1,672 | <ASSISTANT_TASK:>
Python Code:
import quandl
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
start='2015-01-01'
end='2017-01-01'
united = quandl.get("WIKI/UAL", start_date=start, end_date=end)
united.head()
american = quandl.get("WIKI/AAL", start_date=start, end_date=end)
ameri... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Co-integration (advanced topic) is harder to find than correlation.
Step2: Conclusion
Step3: Custom Z-Score function
Step4: Calculating a rol... |
1,673 | <ASSISTANT_TASK:>
Python Code:
from seuif97 import *
# State 1
p1 = 8.0 # in MPa
t1 = px2t(p1, 1)
h1 = px2h(p1, 1) # h1 = 2758.0 From table A-3 kj/kg
s1 = px2s(p1, 1) # s1 = 5.7432 From table A-3 kj/kg.k
# State 2 ,p2=0.008
p2 = 0.008
s2 = s1
t2 = ps2t(p2, s2)
h2 = ps2h(p2, s2)
# State 3 is... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 1..2 Analysis the Cycle
Step2: (b) The back work ratio is
Step3: 2 Example8.2
Step4: 2.2 Analysis the Cycle
Step5: 1.2.3 T-S Diagram
|
1,674 | <ASSISTANT_TASK:>
Python Code:
from OCR_lib import word_to_vec, reshape_embeddings, detect_text
import spacy
import tensorflow as tf
import numpy as np
from PIL import Image, ImageShow
import IPython.display as display
TEST_STRING = "Test string"
word_embedding = word_to_vec("Test")
nlp = spacy.load("en_core_web_lg")
... | <SYSTEM_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 for function word_to_vec
Step2: Test for reshape_embeddings()
Step3: Test for detect_text()
|
1,675 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
ls -l /home/data/APD/COBRA-YTD*.csv.gz
df = pd.read_csv('/home/data/APD/COBRA-YTD-multiyear.csv.gz')
df.shape
df.dtypes
#brdf = pd.read_csv('/home/pmolnar/burglary_residence.csv')
#brdf.head()
dataDi... | <SYSTEM_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 enter the descriptions for each entry in our dictionary manually. However, why not just create a the Python code automatically...
Ste... |
1,676 | <ASSISTANT_TASK:>
Python Code:
#@title Install software packages {'form-width':'30%'}
%reset -f
!apt-get update
!apt-get install -y xvfb python-opengl ffmpeg
!pip install gym
!pip install imageio
!pip install PILLOW
!pip install pyglet
!pip install pyvirtualdisplay
!pip install dm-acme
!pip install dm-acme[reverb,tf,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:
Step3: Learning about Reinforcement Learning
Step4: Environments
Step5: Random Agent
Step6: Custom Agent
Step8: How to train your agent?
Step10: H... |
1,677 | <ASSISTANT_TASK:>
Python Code:
print("C'est parti") # affiche le texte en dessous
# essayez de modifier le texte et ré-exécuter
# Exécutez cette cellule !
import platform
print("Vous travaillez actuellement sur la version", platform.python_version())
# Exécutez cette cellule !
from IPython.core.display import HTML
s... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Vérifiez quelle est votre version de Python
Step2: Exécutez cette cellule pour appliquer le style CSS utilisé dans ce notebook
Step3: Dans l... |
1,678 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import os
import numpy as np
import pandas as pd
import scipy as sp
import sklearn
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.cross_validation import cross_val_score
from sklearn.ensemble import RandomForestClassifier
dataDir = os.path.join... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load data
Step2: Create the matrix and simplify the classification space
Step3: Random Forest
Step4: Unbalanced design
Step5: In short , we ... |
1,679 | <ASSISTANT_TASK:>
Python Code:
numbers = [1, 2]
numbers = numbers + [3, 4]
print(numbers)
numbers = numbers * 2
print(numbers)
numbers == [1, 2, 3, 4]
1 in numbers
[1, 2] in numbers
print(numbers)
print("Flip the order: " + str(numbers[::-1]))
print("Only first 4 items: " + str(numbers[:4]))
print("Only first 4 items... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <p style="text-align
Step2: <p style="text-align
Step3: <p style="text-align
Step4: <p style="text-align
Step5: <p style="text-align
Step6: ... |
1,680 | <ASSISTANT_TASK:>
Python Code:
# !!!! Also need to add MM folder to system PATH
# mm_version = 'C:\Micro-Manager-1.4'
# cfg = 'C:\Micro-Manager-1.4\SetupNumber2_05102016.cfg'
mm_version = 'C:\Program Files\Micro-Manager-2.0beta'
cfg = 'C:\Program Files\Micro-Manager-2.0beta\Setup2_20170413.cfg'
import sys
sys.path.inse... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Preset
Step2: Example
Step3: Example
Step4: Example
Step5: Example
Step6: Example
|
1,681 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import textmining_blackboxes as tm
#see if package imported correctly
tm.icantbelieve("butter")
title_info=pd.read_csv('data/na-slave-narratives/data/toc.csv')
#this is the "metadata" of these files--we didn't use to... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: IMPORTANT
Step2: Let's get some text
Step3: list comprehensions!
Step4: How to process text
Step5: Our first tool
Step6: for the documentat... |
1,682 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import os
assert os.path.isfile('yearssn.dat')
data=np.loadtxt('yearssn.dat')
year=data[0:len(data),0]#gets the first term of every list in the array
ssc=data[0:len(data),1]#gets the 2nd term of each lsit
assert len(y... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Line plot of sunspot data
Step2: Use np.loadtxt to read the data into a NumPy array called data. Then create two new 1d NumPy arrays named year... |
1,683 | <ASSISTANT_TASK:>
Python Code:
from stingray.simulator.simulator import Simulator
from scipy.ndimage.filters import gaussian_filter1d
from stingray.utils import baseline_als
from scipy.interpolate import interp1d
np.random.seed(1034232)
# Simulate a light curve with increasing variability and flux
length = 10000
dt = 0... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: R.m.s. - intensity diagram
|
1,684 | <ASSISTANT_TASK:>
Python Code:
train_size = 50
rng = np.random.RandomState(0)
x = rng.uniform(0, 5, 100)
y = np.array((x > 2.5)*2-1, dtype=int)
plt.scatter(x,y)
k1 = SqExp(1,1)
gpcb = GPCB(k1)
gpcb.train(x,y)
x_star = x
pi_hat_star_mean = gpcb.predict(x_star)
pi_star_mean = gpcb.predict(x_star,False)
plt.scatter(x_st... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Train the Model
Step2: Predict
Step3: Binary Classification (using GPC)
Step4: Train the Model
|
1,685 | <ASSISTANT_TASK:>
Python Code:
from collections import namedtuple, defaultdict
import random
import numpy as np
from tqdm import tqdm
%matplotlib inline
import matplotlib.pyplot as plt
MAX_SPEED = 4
N_ACTIONS = 3 # number of actions along x and y: 0, 1, -1
track1 =
XXXXXXXXXXXXXF
XXXXXXXXXXX... | <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: Define Racetracks
Step4: Create Racetrack environment
Step5: Off-Policy Monte Carlo Control
Step6: Solve Racetrack MDP
Step7: Visualize traj... |
1,686 | <ASSISTANT_TASK:>
Python Code:
import random
import pandas as pd
import matplotlib as mpl
import seaborn as sb
%matplotlib inline
class LotterySimulation(object):
def __init__(self, lottery, n_tickets, n_players):
self.lottery = lottery
self.n_tickets = n_tickets
self.n_players = n_players
... | <SYSTEM_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 Lottery class takes four parameters
Step2: Mega Millions
Step3: 100,000 player simulations — Mega Millions
Step4: 1 million 50-ticket sim... |
1,687 | <ASSISTANT_TASK:>
Python Code:
data = np.random.uniform(0,1, (100,3))
class SelfOrganizingMap(nengo.Process):
def __init__(self, weights, learning_rate=1e1, influence_sigma=1.5):
self.weights = weights
self.learning_rate = learning_rate
self.influence_sigma = influence_sigma
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Now we implement the self-organizing map. Since this requires implementing our own learning rule, we'll have to add our own python code to do t... |
1,688 | <ASSISTANT_TASK:>
Python Code:
# Magics first (server issues)
%matplotlib inline
# Do below if you want interactive matplotlib plot ()
# %matplotlib notebook
# https://ipython.org/ipython-doc/dev/config/extensions/autoreload.html
%load_ext autoreload
%autoreload 2
# %install_ext http://raw.github.com/jrjohansson/vers... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Importing cleaned data
Step2: [Dead end] Does year predict production?
Step3: Does Hours worked correlate with output?
Step4: Advanced exampl... |
1,689 | <ASSISTANT_TASK:>
Python Code:
# necessary imports
%pylab inline
import seaborn as sns
import pandas as pd
# locations of the results
results_filename="/home/chiroptera/workspace/QCThesis/CUDA/tests/test1v2/results.csv" #local
#results_filename="https://raw.githubusercontent.com/Chiroptera/QCThesis/master/CUDA/tests/te... | <SYSTEM_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 of the parameters were don't change in these results, so we can delete them (natural number of clusters, dimensionality and number of itera... |
1,690 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
x = np.array([1,2,3,4,5])
print(x)
y = x**2
print(y)
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
x = np.arange(1,10,.1)
y = x**2
p = plt.plot(x,y)
#Example conditional statements
x = 1
y = 2
x<y #x is less than y
#x is greater than y
x>y
#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: Here we are calling in the contents of numpy and giving it the shorthand name 'np' for convenience.
Step2: As we learned in Lecture 1, numpy ar... |
1,691 | <ASSISTANT_TASK:>
Python Code:
import sympy
import pyeda.boolalg.expr
import pyeda.boolalg.bfarray
xs = sympy.symbols(",".join("x%d" % i for i in range(64)))
ys = pyeda.boolalg.bfarray.exprvars('y', 64)
f = sympy.Xor(*xs[:4])
g = pyeda.boolalg.expr.Xor(*ys[:4])
f.atoms()
g.support
f.subs({xs[0]: 0, xs[1]: 1})
g.re... | <SYSTEM_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 Variables
Step2: Basic Boolean Functions
Step3: Create a PyEDA XOR function
Step4: SymPy atoms method is similar to PyEDA's support pr... |
1,692 | <ASSISTANT_TASK:>
Python Code:
# 多行结果输出支持
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
import numpy as np
def LU(A):
U = np.copy(A)
m, n = A.shape
L = np.eye(n)
for k in range(n-1):
for j in range(k+1,n):
L[j,k] = U[j,k]/... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: LU 分解
Step2: The LU factorization is useful!
Step3: 广播运算
|
1,693 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division, print_function
import numpy as np
import qutip as qt
from qutip.ipynbtools import version_table
%matplotlib inline
qt.settings.colorblind_safe = True
qt.visualization.hinton(qt.identity([2, 3]).unit());
qt.visualization.hinton(qt.Qobj([
[1, 0.5],
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Imports
Step2: Plotting Support
Step3: Settings
Step4: Superoperator Representations and Plotting
Step5: We show superoperators as matrices ... |
1,694 | <ASSISTANT_TASK:>
Python Code:
import tensorflow as tf
import tensorflow_datasets as tfds
import numpy as np
import uncertainty_baselines as ub
def _ensemble_accuracy(labels, logits_list):
Compute the accuracy resulting from the ensemble prediction.
per_probs = tf.nn.softmax(logits_list)
probs = tf.reduce_mean(pe... | <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: Hyperparameter Ensembles for Robustness and Uncertainty Quantification
Step4: Let's construct the hyper-deep ensemble over a ResNet-20 architec... |
1,695 | <ASSISTANT_TASK:>
Python Code:
supplyside = ['start_brandh', [ 'branch1', 'branch2', 'branch3'], 'end_branch']
demandside = ['d_start_brandh', ['d_branch1', 'd_branch2', 'd_branch3'], 'd_end_branch']
# you would normaly install eppy by doing
# python setup.py install
# or
# pip install eppy
# or
# easy_instal... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Eppy will build the build the shape/topology of the loop using the two lists above. Each branch will have a placeholder component, like a pipe o... |
1,696 | <ASSISTANT_TASK:>
Python Code:
from dkrz_forms import form_widgets
form_widgets.show_status('form-submission')
from dkrz_forms import form_handler, form_widgets
#please provide your last name - replacing ... below
MY_LAST_NAME = "ki"
form_info = form_widgets.check_pwd(MY_LAST_NAME)
sf = form_handler.init_form(form_in... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Please provide information to unlock your form
Step2: Please provide the following information
Step3: technical information concerning your re... |
1,697 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
train = pd.read_csv("data/train.csv", dtype={"Age": np.float64}, )
test = pd.read_csv("data/test.csv", dtype={"Age": np.float64}, )
def harmonize_data(titanic):
titanic["Age"] = titanic["Age"].fillna(titanic["Age"].median())
titanic["Ag... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Main part
Step2: Compare to Logistic Regression
|
1,698 | <ASSISTANT_TASK:>
Python Code:
#Imports
from numpy import *
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.integrate import quad
from scipy.special import erf
import sys
import os
#Import custom modules
sys.path.append('/home/drake/Documents/Physics/Research/Python/Modules')
from physics import *
%... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <h3>Calculation of the phosphor layer thickness of lanex regular given its areal density
Step2: <h3>Define functions for photon density and pho... |
1,699 | <ASSISTANT_TASK:>
Python Code:
# Import Python libaries
# ----------------------
import numpy as np # NumPy library
from denise_IO.denise_out import * # "DENISE" library
para["filename"] = "DENISE_marm_OBC.inp"
para["descr"] = "Marmousi-II"
para["PHYSICS"] = 1
para["MODE"] = 0
para["NX"] = 500... | <SYSTEM_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. Short description of modelling/FWI problem
Step2: Give a short description of your modelling/FWI problem
Step3: What kind of PHYSICS do you... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.