Unnamed: 0 int64 0 16k | text_prompt stringlengths 110 62.1k | code_prompt stringlengths 37 152k |
|---|---|---|
3,600 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Ground Penetrating Radar Depth of Investigation and Resolution
Overview
This notebook contains two apps, which are used to complete part 2 and part 3 in team TBL assignment 4
Step1: GPR Zer... | Python Code:
%matplotlib inline
import numpy as np
from geoscilabs.gpr.GPR_zero_offset import WidgetWaveRegime
from geoscilabs.gpr.Attenuation import AttenuationWidgetTBL
Explanation: Ground Penetrating Radar Depth of Investigation and Resolution
Overview
This notebook contains two apps, which are used to complete part... |
3,601 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
A nice way to animate fucntions in jupyter notebooks
ref
Thanks to the heavy recent development dedicated to Matplotlib and the Jupyter Notebook, , Matplotlib 1.5.1 supports inline display o... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation, rc
from IPython.display import HTML
# first set up the figure, the axes and the plot element we want to animate
fig, ax = plt.subplots()
ax.set_xlim( 0, 2)
ax.set_ylim(-1, 2)
line, = ax.plot([],[], lw=2)... |
3,602 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
BigQuery ML models with feature engineering
In this notebook, we will use BigQuery ML to build more sophisticated models for taxifare prediction.
This is a continuation of our first models w... | Python Code:
%%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os
PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PROJECT NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# Do not change these
o... |
3,603 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Homework 9 - Clustering
Isac do Nascimento Lira, 371890
1 - Aplique os algoritmos K-means [1] e AgglomerativeClustering [2] em qualquer dataset que você desejar (recomendação
Step1: 2 - Qua... | Python Code:
from sklearn import datasets
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering as AC
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import numpy as np
from sklearn import metrics
%matplotlib inline
# Carrega os dados
irisDF = ... |
3,604 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<div style='background-image
Step1: 1. Initialization of setup
Step2: 2. Elemental Mass and Stiffness matrices
The mass and the stiffness matrix are calculated prior time extrapolation, so... | Python Code:
# Import all necessary libraries, this is a configuration step for the exercise.
# Please run it before the simulation code!
import numpy as np
import matplotlib.pyplot as plt
from gll import gll
from lagrange1st import lagrange1st
from flux_hetero import flux
# Show the plots in the Notebook.
plt.switch_b... |
3,605 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2020 Google
Step1: Optimization Analysis
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https
Step2: Load Data
Go through each record, load... | 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 writing, software
# dist... |
3,606 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Reading and writing an evoked file
This script shows how to read and write evoked datasets.
Step1: Show result as a butterfly plot | Python Code:
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from mne import read_evokeds
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
# Reading
condition = 'Left Auditory'
evoked = read_evoke... |
3,607 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Solving the Schrödinger equation on a computer
The Schrödinger equation governs the behaviour of physical system on scales where quantum mechanical effects become important.
This is a differ... | Python Code:
%pylab inline
from IPython.display import HTML
Explanation: Solving the Schrödinger equation on a computer
The Schrödinger equation governs the behaviour of physical system on scales where quantum mechanical effects become important.
This is a differential equation which belongs to the category of partial ... |
3,608 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2020 The TensorFlow IO Authors.
Step1: Load metrics from Prometheus server
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https
Step2: Inst... | 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 writing, software
# dist... |
3,609 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2020 The TensorFlow Authors.
Step1: Image classification with Model Garden
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https
Step2: Impo... | 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 writing, software
# dist... |
3,610 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Estimating School Tour Scheduling
This notebook illustrates how to re-estimate the mandatory tour scheduling component for ActivitySim. This process
includes running ActivitySim in estimat... | Python Code:
import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
Explanation: Estimating School Tour Scheduling
This notebook illustrates how to re-estimate the mandatory tour scheduling component for ActivitySim. This process
includes running ActivitySim in estimation m... |
3,611 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
4T_Pandas Basic (4) - 파일 입출력 ( csv, excel, sql )
Step1: CSV(Comma Seperated Value) => 각각의 데이터가 ","를 기준으로 나뉜 데이터
예를 들어 김기표 | 29 | 분석가 // sep="|" 이거였어 // 이렇게 하면 ,가 |이걸로 바뀌게 된다.
Step2: 데이터 분... | Python Code:
-실제 엑셀 파일 데이터를 바탕으로 위의 것들을 다시 한 번 실습
-국가별 파일 입출력했음
번외로 수학계산을 해 볼 것이다. max, mean, min, sum
df = pd.DataFrame([{"Name": "KiPyo Kim", "Age": 29}, {"Name": "KiDong Kim", "Age": 33}])
df
# 옵션에 대해서만 알아가자
df.to_csv("fastcampus.csv")
df.to_csv("fastcampus.csv", index=False)
df.to_csv("fastcampus.csv", index=False,... |
3,612 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1> Experimenting with different models </h1>
In this notebook, we try out different ideas. The first thing we have to do is to create a validation set, so that we are not doing experiment... | Python Code:
BUCKET='cs358-bucket'
import os
os.environ['BUCKET'] = BUCKET
from __future__ import print_function
from pyspark.mllib.classification import LogisticRegressionWithLBFGS
from pyspark.mllib.regression import LabeledPoint
from pyspark.sql.types import StringType, FloatType, StructType, StructField
# Create sp... |
3,613 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: TV Script Generation
In this project, you'll generate your own Simpsons TV scripts using RNNs. You'll be using part of the Simpsons dataset of scripts from 27 seasons. The Neural Ne... | Python Code:
DON'T MODIFY ANYTHING IN THIS CELL
import helper
data_dir = './data/divina_commedia.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
#text = text[81:]
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scripts using RN... |
3,614 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Going to train on 50,000,000 molecules from GDB-17
May later try scraping for all molecules w/ positive charge
Step1: only N+ contain positive charges in this dataset
Step2: We may want to... | Python Code:
import matplotlib.pylab as plt
import numpy as np
import seaborn as sns; sns.set()
%matplotlib inline
import keras
from keras.models import Sequential, Model
from keras.layers import Dense
from keras.optimizers import Adam
import salty
from numpy import array
from numpy import argmax
from sklearn.preproces... |
3,615 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
SEQUENCES
Preliminary imports, you need to run this cell before any other cell in this notebook.
Step1: Discrete time
Step2: Linear Difference Equations
A linear difference equation(LDE) i... | Python Code:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
from __future__ import print_function
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
def plotSequence(y):
n = np.linspace(0, y.size, y.size)
plt.scatter(n, y)
plt.plot([n, n], [np.zeros(n.s... |
3,616 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementat... | Python Code:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of t... |
3,617 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Lesson 1
Data Wrangling
Step1: Quizzes
Your task is as follows
Step2: Playing around with web services and requests
Step3: Problem sets
Handle CSV files
Your task is to process the suppli... | Python Code:
# set up environment
import numpy as np
import pandas as pd
Explanation: Lesson 1
Data Wrangling
End of explanation
# read data from local file system
data = pd.read_excel("2013_ERCOT_Hourly_Load_Data.xls")
data.head()
data.dtypes
data["COAST"].describe()
print(data["COAST"].max(), data["COAST"].min(), np.... |
3,618 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Import modules
Step1: Load MNIST Fashion data
Step2: Create seperate class list
Step3: Convert lists to numpy arrays
Step4: Plot sample images from each class
Class Description
0 T-shi... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import csv
import os
from PIL import Image
Explanation: Import modules
End of explanation
path = '/some/dir/'
with open(path + 'fashion-mnist_train.csv') as csvfile:
clothing_reader = csv.reader(csvfile)
next(clothing_reader)
... |
3,619 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Harassment and Newcomer Retention (Paper)
Regression analysis notebook for study of harassment on newcomer retention in Wikipedia. See research project page for an overview.
Step1: Load Dat... | Python Code:
% matplotlib inline
import pandas as pd
from dateutil.relativedelta import relativedelta
import statsmodels.formula.api as sm
import requests
from io import StringIO
import math
import pandas as pd
Explanation: Harassment and Newcomer Retention (Paper)
Regression analysis notebook for study of harassment o... |
3,620 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Graded = 7/7
HOMEWORK 06
You'll be using the Dark Sky Forecast API from Forecast.io, available at https
Step1: 2) What's the current wind speed? How much warmer does it feel than it actuall... | Python Code:
import config
import requests
weather_key = config.weather_key
# api key - latitude, longitude, time (epoch)
#without time parameter
response = requests.get('https://api.forecast.io/forecast/' + weather_key + '/39.0068,76.7791')
#on my birthdate - time parameter
#response = requests.get('https://api.fore... |
3,621 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Getting started with TensorFlow
Learning Objectives
1. Practice defining and performing basic operations on constant Tensors
1. Use Tensorflow's automatic differentiation capability
1.... | Python Code:
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.0 || pip install tensorflow==2.0
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
print(tf.__version__)
Explanation: Getting started with TensorFlow
Learning Objectives
1. Practice defin... |
3,622 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Conditional statements
The most common conditional statement in Python is the if-elif-else statement
Step1: There is no switch-case type of statement in Python.
Note
Step2: While statement... | Python Code:
value = 4
value = value + 1
if value < 5:
print("value is less than 5")
elif value > 5:
print("value is more than 5")
else:
print("value is precisely 5")
# go ahead and experiment by changing the value
Explanation: Conditional statements
The most common conditional statement in Python is the if... |
3,623 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
1T_Pandas 의 자료형 - Series, DataFrame
오늘의 과정
Pandas
=> 데이터 입력 ( 우리가 직접 수작업, 엑셀, CSV, DB )
=> 데이터 출력 ( print, csv, excel, ... db )
=> 데이터 전처리 ( preprocess => 우리가 수집한/크롤링한 정보를 분석 가능한 형태로 만들어주는 작... | Python Code:
import pandas as pd # 관례적으로, pandas 를 pd라는 이름으로 import 한다.
Explanation: 1T_Pandas 의 자료형 - Series, DataFrame
오늘의 과정
Pandas
=> 데이터 입력 ( 우리가 직접 수작업, 엑셀, CSV, DB )
=> 데이터 출력 ( print, csv, excel, ... db )
=> 데이터 전처리 ( preprocess => 우리가 수집한/크롤링한 정보를 분석 가능한 형태로 만들어주는 작업 )
=> 조금 더 복잡한, => 크롤링 ( AJAX POST , select... |
3,624 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Table of Contents
<p><div class="lev1 toc-item"><a href="#Query-Data" data-toc-modified-id="Query-Data-1"><span class="toc-item-num">1 </span>Query Data</a></div><div class="lev1 ... | Python Code:
import requests as rq
import pandas as pd
import matplotlib.pyplot as mpl
import bs4
import os
from tqdm import tqdm_notebook
from datetime import time
%matplotlib inline
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Query-Data" data-toc-modified-id="Query-Data-1"><span class="toc-... |
3,625 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
E2E ML on GCP
Step1: Restart the kernel
After you install the additional packages, you need to restart the notebook kernel so it can find the packages.
Step2: Before you begin
GPU runtime
... | Python Code:
import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
U... |
3,626 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Advent of Code 2017
December 3rd
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern start... | Python Code:
k = 4
Explanation: Advent of Code 2017
December 3rd
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first fe... |
3,627 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Apache Spot's Ipython Advanced Mode
DNS
This guide provides examples about how to request data, show data with some cool libraries like pandas and more.
Import Libraries
The next cell will i... | Python Code:
import datetime
import pandas as pd
import numpy as np
import linecache, bisect
import os
spath = os.getcwd()
path = spath.split("/")
date = path[len(path)-1]
Explanation: Apache Spot's Ipython Advanced Mode
DNS
This guide provides examples about how to request data, show data with some cool libraries like... |
3,628 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Process U-Wind
Step1: 2. Read u-wind data and pick variables
2.1 Use print to check variable information.
Actually, you can also use numdump infile.nc -h to check the same inforamtion
Step2... | Python Code:
% matplotlib inline
from pylab import *
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap # plot on map projections
from netCDF4 import Dataset as netcdf # netcdf4-python module
Explanation: Process U-Wind: Mean and Std
In this notebook, we will do a little complic... |
3,629 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
From transfer function to difference equation
In approximately the middle of Peter Corke's lecture Introduction to digital control, he explaines how to go from a transfer function descriptio... | Python Code:
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
%matplotlib inline
# Define the continuous-time linear time invariant system F
a = 2
b = 1
num = [1, b]
den = [1, a]
F = signal.lti(num, den)
# Plot a step response
(t, y) = signal.step(F)
plt.figure(figsize=(14,6))
plt.plot(t... |
3,630 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Make a well
Step1: Make a striplog and add it to the well
Step2: Striplogs are added as a dictionary, but you can access them via attributes too
Step3: Make another striplog and add it
We... | Python Code:
from striplog import Well
print(Well.__doc__)
fname = 'P-129_out.LAS'
well = Well(fname)
well.data['GR']
well.well.DATE.data
Explanation: Make a well
End of explanation
from striplog import Striplog, Legend
legend = Legend.default()
f = 'P-129_280_1935.png'
name, start, stop = f.strip('.png').split('_')
st... |
3,631 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Object oriented programming (OOP)
Python is not ony a powerful scripting language, but it also supports object-oriented programming. In fact, everything in Python is an object. Working with ... | Python Code:
print(dir(bool))
Explanation: Object oriented programming (OOP)
Python is not ony a powerful scripting language, but it also supports object-oriented programming. In fact, everything in Python is an object. Working with functions is instead called procedure-oriented programming. Both styles (or philosophie... |
3,632 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Annealed importance sampling
[This largely follows the review in section 3 of
Step1: 2. Define annealing distributions
Here we'll be annealing between two unnormalized Gaussian distribution... | Python Code:
import numpy as np
import numpy.random as npr
npr.seed(0)
import matplotlib.pyplot as plt
plt.rc('font', family='serif')
%matplotlib inline
def annealed_importance_sampling(draw_exact_initial_sample,
transition_kernels,
annealing_distributio... |
3,633 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
전처리, 클래스
그 전에 지금까지 복습한 것 관련 퀴즈 문제
1~100까지의 숫자 중에서 3과 5로 나누어 떨어지는 수를 저장하는 List
Step1: 3의 배수가 입력되면 beer, 5의 배수가 입력되면 chicken, 15의 배수는 beerchicken
Step2: Palindrome
거꾸로 해도 같은 단어
기러기 => 기러기, 소... | Python Code:
print([i for i in range(1, 100+1) if i%3==0 or i%5==0])
Explanation: 전처리, 클래스
그 전에 지금까지 복습한 것 관련 퀴즈 문제
1~100까지의 숫자 중에서 3과 5로 나누어 떨어지는 수를 저장하는 List
End of explanation
num = 15
result = ""
if num % 3 == 0:
result += "Beer"
if num % 5 == 0:
result += "Chichen"
print(result)
result = []
for i in range(... |
3,634 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="https
Step1: To execute the code in the above cell, select it with a click and then either press the play button to the left of the code, or use the keyboard shortcut "Command/Ctrl... | Python Code:
seconds_in_a_day = 24 * 60 * 60
seconds_in_a_day
Explanation: <a href="https://colab.research.google.com/github/cipang/hello-world/blob/master/Welcome_To_Colaboratory.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<p><img alt="Colaborat... |
3,635 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Q1
In this question, we'll review the basics of file I/O (file input/output) and the various function calls and modes required (this will draw on material from L14).
A
Write a function read_... | Python Code:
truth = "This is some text.\nMore text, but on a different line!\nInsert your favorite meme here.\n"
pred = read_file_contents("q1data/file1.txt")
assert truth == pred
retval = -1
try:
retval = read_file_contents("nonexistent/path.txt")
except:
assert False
else:
assert retval is None
Explanati... |
3,636 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Q1
In this question, we'll compute some basic probabilities of events using loops, lists, and dictionaries.
Part A
The Polya urn model is a popular model for both statistics and to illustrat... | Python Code:
u1 = ["green", "green", "blue", "green"]
a1 = set({("green", 3), ("blue", 1)})
assert a1 == set(urn_to_dict(u1).items())
u2 = ["red", "blue", "blue", "green", "yellow", "black", "black", "green", "blue", "yellow", "red", "green", "blue", "black", "yellow", "yellow", "yellow", "green", "blue", "red", "red",... |
3,637 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Simple Reinforcement Learning
Step1: Load the environment
Step2: The Deep Q-Network
Helper functions
Step3: Implementing the network itself
Step4: Training the network
Step5: Some stati... | Python Code:
from __future__ import division
import gym
import numpy as np
import random
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow.contrib.slim as slim
Explanation: Simple Reinforcement Learning: Exploration Strategies
This notebook contains implementations of various ... |
3,638 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Solution of 4.10.1, Jiang et al. 2013
Write a function that takes as input the desired Taxon, and returns the mean value of r.
First, we're going to import the csv module, and read the data.... | Python Code:
import csv
with open('../data/Jiang2013_data.csv') as csvfile:
# set up csv reader and specify correct delimiter
reader = csv.DictReader(csvfile, delimiter = '\t')
taxa = []
r_values = []
for row in reader:
taxa.append(row['Taxon'])
r_values.append(float(row['r']))
Expla... |
3,639 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
odm2api demo with Little Bear SQLite sample DB
Largely from https
Step1: SamplingFeatures tests
Step2: Back to the rest of the demo
Step3: Foreign Key Example
Drill down and get objects l... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib import dates
from odm2api.ODMconnection import dbconnection
from odm2api.ODM2.services.readService import ReadODM2
# Create a connection to the ODM2 database
# ----------------------------------------
odm2db_fpth = '/home/mayorga/Desktop/Ty... |
3,640 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Vertex client library
Step1: Install the latest GA version of google-cloud-storage library as well.
Step2: Restart the kernel
Once you've installed the Vertex client library and Google clo... | Python Code:
import os
import sys
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install -U google-cloud-aiplatform $USER_FLAG
Explanation: Vertex client library: AutoML image object detection model for online prediction
<tab... |
3,641 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1>Functions</h1>
<h2>Calling a function</h2>
Step1: <h2>Installing libraries and importing functions</h2>
Step2: <h2>Importing functions</h2>
Step3: <h3>Returning values from a function... | Python Code:
x=5
y=7
z=max(x,y) #max is the function. x and y are the arguments
print(z) #print is the function. z is the argument
Explanation: <h1>Functions</h1>
<h2>Calling a function</h2>
End of explanation
!pip install easygui
#pip: python installer program
# ! run the program from the shell (not from python)
# ea... |
3,642 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
I am trying to vectorize some data using | Problem:
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
corpus = [
'We are looking for Java developer',
'Frontend developer with knowledge in SQL and Jscript',
'And this is the third one.',
'Is this the first document?',
]
vectorizer = CountVectorizer(... |
3,643 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2019 The TensorFlow Probability Authors.
Licensed under the Apache License, Version 2.0 (the "License");
Step1: Optimizers in TensorFlow Probability
<table class="tfo-notebook-but... | Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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... |
3,644 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
STFT Analysis/Synthesis - MusicBricks Tutorial
Introduction
This tutorial will guide you through some tools for performing spectral analysis and synthesis using the Essentia library (http
St... | Python Code:
# import essentia in streaming mode
import essentia
import essentia.streaming as es
Explanation: STFT Analysis/Synthesis - MusicBricks Tutorial
Introduction
This tutorial will guide you through some tools for performing spectral analysis and synthesis using the Essentia library (http://www.essentia.upf.edu... |
3,645 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Continuum subtraction
The analysis and interpretation of spectral-line data is greatly simplified if all sources of continuum emission have already been removed from the data. This chapter d... | Python Code:
print '# Executing MIRIAD commands'
simuv='sim01.uv'
if os.path.exists(simuv): shutil.rmtree(simuv)
run_uvgen=Run('uvgen source=pointsource01.txt ant=ew_layout.txt baseunit=-51.0204 radec=19:39:25.0,-83:42:46 freq=1.4,0 corr=256,1,0,100 out=%s harange=-6,6,0.016667 systemp=0 lat=-30.7 jyperk=19.28'%(simuv)... |
3,646 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Think Bayes
This notebook presents example code and exercise solutions for Think Bayes.
Copyright 2018 Allen B. Downey
MIT License
Step4: The Weibull distribution
The Weibull distribution i... | Python Code:
# Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import classes from thinkbayes2
from thinkbayes2 import Pmf, Cdf, Suite, Joint
import thinkb... |
3,647 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
FloPy
SWI2 Example 4. Upconing Below a Pumping Well in a Two-Aquifer Island System
This example problem is the fourth example problem in the SWI2 documentation (http
Step1: Define model nam... | Python Code:
%matplotlib inline
import os
import sys
import platform
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import flopy
print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('matplotlib version: {}'.format(mpl.__version__))
print('flopy version: {}'.format(flop... |
3,648 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Choosing a loss function for regression
TL;DR
In short, the workflow can be summarized as follows
Step1: The problem with the squared error is that it makes small errors (< 1.0) even smalle... | Python Code:
a = symbols('a') #actual value
p = symbols('p') #predicted value
mse = lambda a,p: (a-p)**2
mse_plot = plot(mse(0, p),(p, -3, 3), show=False, legend=True, line_color="red")
mse_plot[0].label='MSE'
mse_plot.show()
Explanation: Choosing a loss function for regression
TL;DR
In short, the workflow can be summa... |
3,649 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Embedding Matplotlib Animations in IPython Notebooks
This notebook first appeared as a
blog post
on
Pythonic Perambulations.
License
Step2: Now we'll create a function that will save an ani... | Python Code:
%pylab inline
Explanation: Embedding Matplotlib Animations in IPython Notebooks
This notebook first appeared as a
blog post
on
Pythonic Perambulations.
License: BSD
(C) 2013, Jake Vanderplas.
Feel free to use, distribute, and modify with the above attribution.
<!-- PELICAN_BEGIN_SUMMARY -->
I've spent a lo... |
3,650 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
gc exposes the underlying memory management mechanism of Python, the automatic garbage collector. The module includes functions for controlling how the collector operates and to examine the ... | Python Code:
import gc
import pprint
class Graph:
def __init__(self, name):
self.name = name
self.next = None
def set_next(self, next):
print('Linking nodes {}.next = {}'.format(self, next))
self.next = next
def __repr__(self):
return '{}({})'.format(
self... |
3,651 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Experiments reported in "Domain Conditional Predictors for Domain Adaptation"
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this f... | Python Code:
#@test {"skip": true}
!pip install dm-sonnet==2.0.0 --quiet
!pip install tensorflow_addons==0.12 --quiet
#@test {"output": "ignore"}
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
import tensorflow_addons as tfa
try:
import sonnet.v2 as snt
except ModuleNotFoundError:
imp... |
3,652 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Logistic Regression
Notebook version
Step1: Logistic Regression
1. Introduction
1.1. Binary classification and decision theory. The MAP criterion
Goal of a classification problem is to assi... | 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
from sklearn import linear_mod... |
3,653 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Background Modeling
When fitting a spectrum with a background, it is invalid to simply subtract off the background if the background is part of the data's generative model van Dyk et al. (20... | Python Code:
from threeML import *
%matplotlib inline
import warnings
warnings.simplefilter('ignore')
Explanation: Background Modeling
When fitting a spectrum with a background, it is invalid to simply subtract off the background if the background is part of the data's generative model van Dyk et al. (2001). Therefore,... |
3,654 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Content and Objective
Show different aspects when dealing with FFT
Using rectangular function in time and frequency for illustration
Importing and Plotting Options
Step1: Define Rect and Ge... | Python Code:
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
# plotting options
font = {'size' : 20}
plt.rc('font', **font)
plt.rc('text', usetex=True)
matplotlib.rc('figure', figsize=(18, 6) )
Explanation: Content and Objective
Show different aspects when dealing with FFT
Usi... |
3,655 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Jupyter Notebooks Advanced Features
<div class="alert bg-primary">PYNQ notebook front end allows interactive coding, output visualizations and documentation using text, equations, images, vi... | Python Code:
import random
the_number = random.randint(0, 10)
guess = -1
name = input('Player what is your name? ')
while guess != the_number:
guess_text = input('Guess a number between 0 and 10: ')
guess = int(guess_text)
if guess < the_number:
print(f'Sorry {name}, your guess of {guess} was too LO... |
3,656 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Ocean
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify d... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-2', 'ocean')
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CMCC
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Timestepping Framework, Ad... |
3,657 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step7: 4T_Pandas로 배우는 SQL 시작하기 (4) - HAVING, SUB QUERY
SQL => 연산의 결과로 나온 데이터를 다시 Filtering ( HAVING )
SUB QUERY + TEMPORARY TABLE ( 임시 테이블 )
실습)
"5월 달에" / "지금까지" 렌탈 횟수가 30회 이상인 유저
유저이름과 유저 이... | Python Code:
import pymysql
import curl
db = pymysql.connect(
"db.fastcamp.us",
"root",
"dkstncks",
"sakila",
charset = "utf8",
)
customer_df = pd.read_sql("SELECT * FROM customer;", db)
rental_df = pd.read_sql("SELECT * FROM rental;", db)
df = rental_df.merge(customer_df, on="customer_id")
df.head(... |
3,658 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Тематическая модель Постнауки
Peer Review (optional)
В этом задании мы применим аппарат тематического моделирования к коллекции текстовых записей видеолекций, скачанных с сайта Постнаука. Мы... | Python Code:
import artm
from matplotlib import pyplot as plt
import seaborn as sns
%matplotlib inline
sns.set_style("whitegrid", {'axes.grid' : False})
import numpy as np
import pandas as pd
from sklearn.externals import joblib
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_intera... |
3,659 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Lektion 13
Step1: Besselfunktionen
Step2: Die ungeraden a werden rückwärts gelöst. Das ist verwirrend.
Step3: Wir hatten das beim ersten Mal mit $N=8$ gemacht. Das sind zu wenige Daten.... | Python Code:
from sympy import *
init_printing()
from IPython.display import display
Explanation: Lektion 13
End of explanation
x = Symbol('x')
y = Function('y')
dgl = Eq(y(x).diff(x, 2), -1/x*y(x).diff(x) + 1/x**2*y(x) +4*y(x))
dgl
#dsolve(dgl) # NotImplementedError
#N = 8
N=18
a = [Symbol('a'+str(j)) for j in range... |
3,660 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Implementing a Weighted Majority Rule Ensemble Classifier in scikit-learn
<br>
<br>
Here, I want to present a simple and conservative approach of implementing a weighted majority rule ensemb... | Python Code:
from sklearn import datasets
iris = datasets.load_iris()
X, y = iris.data[:, 1:3], iris.target
from sklearn import cross_validation
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier
import numpy as np
np.rando... |
3,661 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Create the bag of words
Step1: Claculate cosine
I've tried here to compare first centence's vector to all other vectors.
First vector status is not spam (=False). I also calculate how many ... | Python Code:
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer(analyzer = "word", \
tokenizer = None, \
preprocessor = None, \
stop_words = None, \
max_featur... |
3,662 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Ejemplo de como correr interactivamente la libreria TensorFlow en IPython
Step1: De esta manera lanzar una sesion interactiva, util cuando queremos probar metodos
Step2: Probamos la funcio... | Python Code:
import tensorflow as tf
Explanation: Ejemplo de como correr interactivamente la libreria TensorFlow en IPython
End of explanation
sess = tf.InteractiveSession()
x = tf.Variable([[2.0, 3.0],[4.0, 12.0]])
Explanation: De esta manera lanzar una sesion interactiva, util cuando queremos probar metodos
End of ex... |
3,663 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
1. Understanding currents, fields, charges and potentials
Cylinder app
survey
Step1: 2. Potential differences and Apparent Resistivities
Using the widgets contained in this notebook you wil... | Python Code:
app = cylinder_app();
display(app)
Explanation: 1. Understanding currents, fields, charges and potentials
Cylinder app
survey: Type of survey
A: (+) Current electrode location
B: (-) Current electrode location
M: (+) Potential electrode location
N: (-) Potential electrode location
r: radius of cylinder... |
3,664 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
CNN Implementation
Object recognition and categorization using TensorFlow required a basic understanding of convolutions (for CNNs), common layers (non-linearity, pooling, fc), image loading... | Python Code:
# setup-only-ignore
import tensorflow as tf
sess = tf.InteractiveSession()
import glob
image_filenames = glob.glob("./imagenet-dogs/n02*/*.jpg")
image_filenames[0:2]
Explanation: CNN Implementation
Object recognition and categorization using TensorFlow required a basic understanding of convolutions (for CN... |
3,665 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
2章 パーセプトロン
2.1 パーセプトロンとは
xは入力信号、yは出力信号、wは重みを表す。
ニューロンの発火する限界値を閾値(θ)とする。
$$
y
= \begin{cases}
& \ 0 \; (w_{1}x_{1} + w_{1}x_{2} \leq \theta) \
& \ 1 \; (w_{1}x_{1} + w_{1}x_{2} > \theta)
\e... | Python Code:
# ANDの実装
def func_AND(x1, x2):
w1, w2, theta = 0.5, 0.5, 0.7
tmp = x1*w1 + x2*w2
if tmp <= theta:
return 0
elif tmp > theta:
return 1
print(func_AND(0, 0))
print(func_AND(1, 0))
print(func_AND(0, 1))
print(func_AND(1, 1))
Explanation: 2章 パーセプトロン
2.1 パーセプトロンとは
xは入力信号、yは出... |
3,666 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2019 The TensorFlow Authors.
Step1: Migrating tf.summary usage to TF 2.x
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https
Step2: Tensor... | 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 writing, software
# dist... |
3,667 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Using turicreate for easy ML on SEEG dataset
For example, one thing that makes it easy is that turicreate automagically creates dummy variables for categorical features.
Step1: Reading clea... | Python Code:
import turicreate as tc
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: Using turicreate for easy ML on SEEG dataset
For example, one thing that makes it easy is that turicreate automagically creates dummy variables for categorical features.
End of explanation
sf = tc.SFr... |
3,668 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step 1
Step1: Step 3
Step2: Step 4
Step3: Step 5
Step4: Step 5a
Step5: Step 6
Step6: Step 7
Step7: Step 8
Step8: Step 9
Step9: Step 10 | Python Code:
X = tf.placeholder(tf.float32, name="X")
Y = tf.placeholder(tf.float32, name="Y")
Explanation: Step 1: read in data from the .xls file
Step 2: create placeholders for input X (number of fire) and label Y (number of theft)
End of explanation
w = tf.Variable(0.0, name='w')
b = tf.Variable(0.0, name='b')
Expl... |
3,669 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Compute spatial resolution metrics in source space
Compute peak localisation error and spatial deviation for the point-spread
functions of dSPM and MNE. Plot their distributions and differen... | Python Code:
# Author: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_resolution_matrix
from mne.minimum_norm import resolution_metrics
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/sub... |
3,670 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Adding optional relationships changes the dcnt value
SYNOPSIS
Step1: 2) Depth-01 term, GO
Step2: Notice that dcnt=0 for GO
Step3: 3) Depth-01 term, GO
Step4: 4) Depth-01 term, GO
Step5: ... | Python Code:
from goatools.base import get_godag
godag = get_godag("go-basic.obo", optional_attrs={'relationship'})
go_leafs = set(o.item_id for o in godag.values() if not o.children)
Explanation: Adding optional relationships changes the dcnt value
SYNOPSIS: For GO:0019012, virion, the descendants count dcnt, is:
* ... |
3,671 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Conditional Probability
This lab is an introduction to visualizing conditional probabilities. We will cover icon arrays. These do not appear in the textbook and will not appear on any exam... | Python Code:
# Run this cell to set up the notebook, but please don't change it.
# These lines import the Numpy and Datascience modules.
import numpy as np
from datascience import *
# These lines do some fancy plotting magic.
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirty... |
3,672 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
An Introduction to py-Goldsberry
py-Goldsberry is a Python package that makes it easy to interface with the http
Step1: py-goldsberry is designed to work in conjuntion with Pandas. Each fun... | Python Code:
import goldsberry
import pandas as pd
goldsberry.__version__
Explanation: An Introduction to py-Goldsberry
py-Goldsberry is a Python package that makes it easy to interface with the http://stats.nba.com and retrieve the data in a more analyzable format.
This is the first in a series of tutorials that walk... |
3,673 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.... | Python Code:
import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network ... |
3,674 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Zobrazování dat s knihovnou Matplolib
Matplotlib je knihovna napsaná v Pythonu pro vizualizování dat různými způsoby. Jedná se o nejpoužívanější knihovnu v Pythonu pro zobrazování dat. Kniho... | Python Code:
# inline plots
%matplotlib inline
# import matplotlib as plt acronym
import matplotlib.pylab as plt
# import numpy as np acronym
import numpy as np
Explanation: Zobrazování dat s knihovnou Matplolib
Matplotlib je knihovna napsaná v Pythonu pro vizualizování dat různými způsoby. Jedná se o nejpoužívanější... |
3,675 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
TensorFlow warmup
This is a notebook to get you started with TensorFlow.
Step5: Graph visualisation
This is for visualizing a TF graph in an iPython notebook; the details are not interestin... | Python Code:
import numpy as np
import tensorflow as tf
Explanation: TensorFlow warmup
This is a notebook to get you started with TensorFlow.
End of explanation
# This is for graph visualization.
from IPython.display import clear_output, Image, display, HTML
def strip_consts(graph_def, max_const_size=32):
Strip lar... |
3,676 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Revisão
Zero de função
Minimos de função
Metodo da bissecao
Step1: Posição Falsa
Só troca a funcao $(A + B) / 2$ por $(A * f(B) - B * f(A)) / (f(B) - f(A))$
Step2: Metodos de newton e seca... | Python Code:
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
# Segundo passo: Definir função
def f(x):
return -x * np.e ** -x + 0.2
def p(A, B):
plt.xlabel('x')
plt.ylabel('y = f(x)')
plt.title('Zero de funcoes')
plt.grid()
plt.plot(x, y)
[xmin, xmax, ymin, ymax] ... |
3,677 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<table class="ee-notebook-buttons" align="left"><td>
<a target="_blank" href="http
Step1: Request body
The request body is an instance of an EarthEngineAsset. This is where the path to th... | Python Code:
# This has details about the Earth Engine Python Authenticator client.
from ee import oauth
from google_auth_oauthlib.flow import Flow
import json
# Build the `client_secrets.json` file by borrowing the
# Earth Engine python authenticator.
client_secrets = {
'web': {
'client_id': oauth.CLIENT_I... |
3,678 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Read surfer grids
There are 3 varieties
Step1: Another ASCII
Step2: A binary file | Python Code:
!head ../data/Surfer/surfer-6-ascii-tiny.grd
import gio
da = gio.read_surfer('../data/Surfer/surfer-6-ascii-tiny.grd')
da
da.max()
Explanation: Read surfer grids
There are 3 varieties:
Surfer 6 binary
Surfer 6 ASCII
Surfer 7 binary
In theory we can read all of these, but I don't have a Surfer 6 binary file... |
3,679 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
To make a better wedge
This notebook is an update to the notebook entitled "To make a wedge" featured in the blog post, To make a wedge, on December 12, 2013.
Start by importing Numpy and Ma... | Python Code:
import numpy as np
% matplotlib inline
import matplotlib.pyplot as plt
Explanation: To make a better wedge
This notebook is an update to the notebook entitled "To make a wedge" featured in the blog post, To make a wedge, on December 12, 2013.
Start by importing Numpy and Matplotlib's pyplot module in the u... |
3,680 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
E2E ML on GCP
Step1: Restart the kernel
Once you've installed the additional packages, you need to restart the notebook kernel so it can find the packages.
Step2: Authenticate your Google ... | Python Code:
import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
U... |
3,681 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2021 The TensorFlow Authors.
Step1: TensorFlow Ranking Keras pipeline for distributed training
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href... | 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 writing, software
# dist... |
3,682 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Introduction
In Carola Lilienthal's talk about architecture and technical debt at Herbstcampus 2017, I was reminded that I wanted to implement some of the examples of her book "Long-l... | Python Code:
import py2neo
import pandas as pd
query=
MATCH
(:Jar:Archive)-[:CONTAINS]->(type:Type)
RETURN
type.fqn AS type, SPLIT(type.fqn, ".")[2] AS subdomain
graph = py2neo.Graph()
subdomaininfo = pd.DataFrame(graph.run(query).data())
subdomaininfo.head()
Explanation: Introduction
In Carola Lilienthal's tal... |
3,683 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
NLP Information Extraction
SparkContext and SparkSession
Step1: Simple NLP pipeline architecture
Reference
Step2: Create a spark data frame to store raw text
Use the nltk.sent_tokenize() f... | Python Code:
from pyspark import SparkContext
sc = SparkContext(master = 'local')
from pyspark.sql import SparkSession
spark = SparkSession.builder \
.appName("Python Spark SQL basic example") \
.config("spark.some.config.option", "some-value") \
.getOrCreate()
Explanation: NLP Information... |
3,684 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Language Translation
In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset o... | Python Code:
# sequence_to_sequence_implementation course assignment was used a lot to finish this hw
# A live help person highly suggested I worked through it again. --- 10000% correct. this was vital
### AKA the UDACITY seq2seq assignment, /deep-learning/seq2seq/sequence_to_sequence_implementation.ipynb
DON'T MODIFY ... |
3,685 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
FAQ
This document will address frequently asked questions not addressed in other pages of the documentation.
How do I install cobrapy?
Please see the INSTALL.rst file.
How do I cite cobrapy?... | Python Code:
from __future__ import print_function
import cobra.test
model = cobra.test.create_test_model()
for metabolite in model.metabolites:
metabolite.id = "test_" + metabolite.id
try:
model.metabolites.get_by_id(model.metabolites[0].id)
except KeyError as e:
print(repr(e))
Explanation: FAQ
This docume... |
3,686 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1>datetime library</h1>
<li>Time is linear
<li>progresses as a straightline trajectory from the big bag
<li>to now and into the future
<li>日期库官方说明 https
Step1: <li>How much time has passe... | Python Code:
d1 = "10/24/2017"
d2 = "11/24/2016"
max(d1,d2)
Explanation: <h1>datetime library</h1>
<li>Time is linear
<li>progresses as a straightline trajectory from the big bag
<li>to now and into the future
<li>日期库官方说明 https://docs.python.org/3.5/library/datetime.html
<h3>Reasoning about time is important in data an... |
3,687 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
SmartSheet Sheet To BigQuery
Move sheet data into a BigQuery table.
License
Copyright 2020 Google LLC,
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fi... | Python Code:
!pip install git+https://github.com/google/starthinker
Explanation: SmartSheet Sheet To BigQuery
Move sheet data into a BigQuery table.
License
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... |
3,688 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<link rel="stylesheet" href="reveal.js/css/theme/sky.css" id="theme">
Step1: <h1>Machine Learning</h1>
<h5>and</h5>
<h1>Probabilistic Programming</h1>
<tiny>Colin Carroll, Kensho</tiny>
Raw... | Python Code:
import matplotlib
%matplotlib inline
from bokeh.plotting import figure, show, ColumnDataSource
from bokeh.models import HoverTool
from bokeh.io import output_notebook, save
from clean_data import (get_models, predict, explain_model, LATEST_DATA as results_2016, get_df,
get_features... |
3,689 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
GA4GH 1000 Genomes Reads Protocol Example
This example illustrates how to access alignment data made available using a GA4GH interface.
Initialize the client
In this step we create a client ... | Python Code:
import ga4gh_client.client as client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
Explanation: GA4GH 1000 Genomes Reads Protocol Example
This example illustrates how to access alignment data made available using a GA4GH interface.
Initialize the client
In this step we create a client object which wi... |
3,690 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Batch Normalization – Lesson
What is it?
What are it's benefits?
How do we add it to a network?
Let's see it work!
What are you hiding?
What is Batch Normalization?<a id='theory'></a>
Batch ... | Python Code:
# Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_... |
3,691 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sklearn
sklearn.liner_model
linear_model
Step1: Генерация данных
Step2: Линейная классификация
RidgeClassifier
Step3: LogisticRegression
Step4: Оценка качества по cross-validation
cross_... | Python Code:
from matplotlib.colors import ListedColormap
from sklearn import cross_validation, datasets, linear_model, metrics
import numpy as np
%pylab inline
Explanation: Sklearn
sklearn.liner_model
linear_model:
* RidgeClassifier
* SGDClassifier
* SGDRegressor
* LinearRegression
* LogisticRegression
* Lasso
* etc
д... |
3,692 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Assessing Cox model fit using residuals (work in progress)
This tutorial is on some common use cases of the (many) residuals of the Cox model. We can use resdiuals to diagnose a model's poor... | Python Code:
df = load_rossi()
df['age_strata'] = pd.cut(df['age'], np.arange(0, 80, 5))
df = df.drop('age', axis=1)
cph = CoxPHFitter()
cph.fit(df, 'week', 'arrest', strata=['age_strata', 'wexp'])
cph.print_summary()
cph.plot();
Explanation: Assessing Cox model fit using residuals (work in progress)
This tutorial is o... |
3,693 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Chapter 1 - The Python Data Model
In this chapter, Mr. Ramalho discusses the Python Data Model. Framework here doesn't mean something like Django or Pyramid, but more about how language feat... | Python Code:
class DaysOfWeek:
def __init__(self):
self._days = ["lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"]
def __getitem__(self, position):
return self._days[position]
def __len__(self):
return len(self._days)
days_of_week = DaysOfWeek()
"... |
3,694 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
1A.data - DataFrame et Matrice
Les DataFrame se sont imposés pour manipuler les données avec le module pandas. Le module va de la manipulation des données jusqu'au calcul d'une régresion lin... | Python Code:
from jyquickhelper import add_notebook_menu
add_notebook_menu()
Explanation: 1A.data - DataFrame et Matrice
Les DataFrame se sont imposés pour manipuler les données avec le module pandas. Le module va de la manipulation des données jusqu'au calcul d'une régresion linéaire.
Avec cette façon de représenter l... |
3,695 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Notebook as a Step using Notebooks Executor
The following sample shows how to use the notebook executor as part of a Vertex AI
Libraries and Variables
Step1: Prerequisites
You need to confi... | Python Code:
!which pip
!pip install kfp --upgrade -q
!pip install --upgrade google-cloud-aiplatform -q
!pip install --upgrade google-cloud-pipeline-components -q
import kfp
import os
from datetime import datetime
from google.cloud import aiplatform
from kfp.v2 import compiler
import google.cloud.aiplatform as aip
kfp.... |
3,696 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Non-parametric between conditions cluster statistic on single trial power
This script shows how to compare clusters in time-frequency
power estimates between conditions. It uses a non-parame... | Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequency import tfr_morlet
from mne.stats import permutation_cluster_test
from mne.datasets import sample
print(__doc__)
Explanation: Non-para... |
3,697 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Multigroup Mode Part I
Step1: We will now create the multi-group library using data directly from Appendix A of the C5G7 benchmark documentation. All of the data below will be created at 29... | Python Code:
import os
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
import openmc
%matplotlib inline
Explanation: Multigroup Mode Part I: Introduction
This Notebook illustrates the usage of OpenMC's multi-group calculational mode with the Python API. This example notebook create... |
3,698 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
NLL Curves
Step1: Graph training error as a function of average NLL over epochs
LR = learning rate {0.1, 0.01, 0.001}
SZ = size of the hidden layer and the embedding size {100, 200, 250}
St... | Python Code:
%matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as ... |
3,699 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sorting Network Sets
Frequently a set of Networks is recorded while changing some other variable; like voltage, or current or time. So... now you have this set of data and you want to look ... | Python Code:
from time import sleep
import skrf as rf
%matplotlib inline
from pylab import *
rf.stylely()
!rm -rf tmp
!mkdir tmp
wg = rf.wr10 # just a dummy media object to generate data
wg.frequency.npoints = 101
for k in range(10):
# timestamp generated with `rf.now_string()`
ntwk = wg.random(name=rf.now_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.