text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Sentiment Identification
## BACKGROUND
A large multinational corporation is seeking to automatically identify the sentiment that their customer base talks
about on social media. They would like to expand this capability into multiple languages. Many 3rd party tools exist for sentiment analysis, however, they need h... | github_jupyter |
# Feature Engineering

## Objective
Data preprocessing and engineering techniques generally refer to the addition, deletion, or transformation of data.
The time spent on identifying data engineering needs can be significant and requires you to spend substantial time understanding ... | github_jupyter |
ERROR: type should be string, got "https://keras.io/examples/structured_data/structured_data_classification_from_scratch/\n\nmudar nome das coisas. Editar como quero // para de servir de exemplo pra o futuro..\n\n```\nimport tensorflow as tf\nimport numpy as np\nimport pandas as pd\nfrom tensorflow import keras\nfrom tensorflow.keras import layers\nimport pydot\nfile_url = \"http://storage.googleapis.com/download.tensorflow.org/data/heart.csv\"\ndataframe = pd.read_csv(file_url)\ndataframe.head()\nval_dataframe = dataframe.sample(frac=0.2, random_state=1337)\ntrain_dataframe = dataframe.drop(val_dataframe.index)\ndef dataframe_to_dataset(dataframe):\n dataframe = dataframe.copy()\n labels = dataframe.pop(\"target\")\n ds = tf.data.Dataset.from_tensor_slices((dict(dataframe), labels))\n ds = ds.shuffle(buffer_size=len(dataframe))\n return ds\n\n\ntrain_ds = dataframe_to_dataset(train_dataframe)\nval_ds = dataframe_to_dataset(val_dataframe)\n```\n\nfor x, y in train_ds.take(1):\n print(\"Input:\", x)\n print(\"Target:\", y)\n \n |||||| entender isto melhor\n\n```\ntrain_ds = train_ds.batch(32)\nval_ds = val_ds.batch(32)\nfrom tensorflow.keras.layers.experimental.preprocessing import Normalization\nfrom tensorflow.keras.layers.experimental.preprocessing import CategoryEncoding\nfrom tensorflow.keras.layers.experimental.preprocessing import StringLookup\n\n\ndef encode_numerical_feature(feature, name, dataset):\n # Create a Normalization layer for our feature\n normalizer = Normalization()\n\n # Prepare a Dataset that only yields our feature\n feature_ds = dataset.map(lambda x, y: x[name])\n feature_ds = feature_ds.map(lambda x: tf.expand_dims(x, -1))\n\n # Learn the statistics of the data\n normalizer.adapt(feature_ds)\n\n # Normalize the input feature\n encoded_feature = normalizer(feature)\n return encoded_feature\n\n\ndef encode_string_categorical_feature(feature, name, dataset):\n # Create a StringLookup layer which will turn strings into integer indices\n index = StringLookup()\n\n # Prepare a Dataset that only yields our feature\n feature_ds = dataset.map(lambda x, y: x[name])\n feature_ds = feature_ds.map(lambda x: tf.expand_dims(x, -1))\n\n # Learn the set of possible string values and assign them a fixed integer index\n index.adapt(feature_ds)\n\n # Turn the string input into integer indices\n encoded_feature = index(feature)\n\n # Create a CategoryEncoding for our integer indices\n encoder = CategoryEncoding(output_mode=\"binary\")\n\n # Prepare a dataset of indices\n feature_ds = feature_ds.map(index)\n\n # Learn the space of possible indices\n encoder.adapt(feature_ds)\n\n # Apply one-hot encoding to our indices\n encoded_feature = encoder(encoded_feature)\n return encoded_feature\n\n\ndef encode_integer_categorical_feature(feature, name, dataset):\n # Create a CategoryEncoding for our integer indices\n encoder = CategoryEncoding(output_mode=\"binary\")\n\n # Prepare a Dataset that only yields our feature\n feature_ds = dataset.map(lambda x, y: x[name])\n feature_ds = feature_ds.map(lambda x: tf.expand_dims(x, -1))\n\n # Learn the space of possible indices\n encoder.adapt(feature_ds)\n\n # Apply one-hot encoding to our indices\n encoded_feature = encoder(feature)\n return encoded_feature\n# Categorical features encoded as integers\nsex = keras.Input(shape=(1,), name=\"sex\", dtype=\"int64\")\ncp = keras.Input(shape=(1,), name=\"cp\", dtype=\"int64\")\nfbs = keras.Input(shape=(1,), name=\"fbs\", dtype=\"int64\")\nrestecg = keras.Input(shape=(1,), name=\"restecg\", dtype=\"int64\")\nexang = keras.Input(shape=(1,), name=\"exang\", dtype=\"int64\")\nca = keras.Input(shape=(1,), name=\"ca\", dtype=\"int64\")\n\n# Categorical feature encoded as string\nthal = keras.Input(shape=(1,), name=\"thal\", dtype=\"string\")\n\n# Numerical features\nage = keras.Input(shape=(1,), name=\"age\")\ntrestbps = keras.Input(shape=(1,), name=\"trestbps\")\nchol = keras.Input(shape=(1,), name=\"chol\")\nthalach = keras.Input(shape=(1,), name=\"thalach\")\noldpeak = keras.Input(shape=(1,), name=\"oldpeak\")\nslope = keras.Input(shape=(1,), name=\"slope\")\n\nall_inputs = [\n sex,\n cp,\n fbs,\n restecg,\n exang,\n ca,\n thal,\n age,\n trestbps,\n chol,\n thalach,\n oldpeak,\n slope,\n]\n\n# Integer categorical features\nsex_encoded = encode_integer_categorical_feature(sex, \"sex\", train_ds)\ncp_encoded = encode_integer_categorical_feature(cp, \"cp\", train_ds)\nfbs_encoded = encode_integer_categorical_feature(fbs, \"fbs\", train_ds)\nrestecg_encoded = encode_integer_categorical_feature(restecg, \"restecg\", train_ds)\nexang_encoded = encode_integer_categorical_feature(exang, \"exang\", train_ds)\nca_encoded = encode_integer_categorical_feature(ca, \"ca\", train_ds)\n\n# String categorical features\nthal_encoded = encode_string_categorical_feature(thal, \"thal\", train_ds)\n\n# Numerical features\nage_encoded = encode_numerical_feature(age, \"age\", train_ds)\ntrestbps_encoded = encode_numerical_feature(trestbps, \"trestbps\", train_ds)\nchol_encoded = encode_numerical_feature(chol, \"chol\", train_ds)\nthalach_encoded = encode_numerical_feature(thalach, \"thalach\", train_ds)\noldpeak_encoded = encode_numerical_feature(oldpeak, \"oldpeak\", train_ds)\nslope_encoded = encode_numerical_feature(slope, \"slope\", train_ds)\n\nall_features = layers.concatenate(\n [\n sex_encoded,\n cp_encoded,\n fbs_encoded,\n restecg_encoded,\n exang_encoded,\n slope_encoded,\n ca_encoded,\n thal_encoded,\n age_encoded,\n trestbps_encoded,\n chol_encoded,\n thalach_encoded,\n oldpeak_encoded,\n ]\n)\nx = layers.Dense(32, activation=\"relu\")(all_features)\nx = layers.Dropout(0.5)(x)\noutput = layers.Dense(1, activation=\"sigmoid\")(x)\nmodel = keras.Model(all_inputs, output)\nmodel.compile(\"adam\", \"binary_crossentropy\", metrics=[\"accuracy\"])\nmodel.fit(train_ds, epochs=50, validation_data=val_ds)\nsample = {\n \"age\": 60,\n \"sex\": 1,\n \"cp\": 1,\n \"trestbps\": 145,\n \"chol\": 233,\n \"fbs\": 1,\n \"restecg\": 2,\n \"thalach\": 150,\n \"exang\": 0,\n \"oldpeak\": 2.3,\n \"slope\": 3,\n \"ca\": 0,\n \"thal\": \"fixed\",\n}\n\ninput_dict = {name: tf.convert_to_tensor([value]) for name, value in sample.items()}\npredictions = model.predict(input_dict)\n\nprint(\n \"This particular patient had a %.1f percent probability \"\n \"of having a heart disease, as evaluated by our model.\" % (100 * predictions[0][0],)\n)\n```\n\n" | github_jupyter |
Greyscale ℓ1-TV Denoising
=========================
This example demonstrates the use of class [tvl1.TVL1Denoise](http://sporco.rtfd.org/en/latest/modules/sporco.admm.tvl1.html#sporco.admm.tvl1.TVL1Denoise) for removing salt & pepper noise from a greyscale image using Total Variation regularization with an ℓ1 data fid... | github_jupyter |
```
%matplotlib inline
```
# Out-of-core classification of text documents
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. We make use of an online classifier, i.e., one that supports the
partial_fit metho... | github_jupyter |
# Basic objects
A `striplog` depends on a hierarchy of objects. This notebook shows the objects and their basic functionality.
- [Lexicon](#Lexicon): A dictionary containing the words and word categories to use for rock descriptions.
- [Component](#Component): A set of attributes.
- [Interval](#Interval): One elemen... | github_jupyter |
# Import Modules
```
import warnings
warnings.filterwarnings('ignore')
from src import detect_faces, show_bboxes
from PIL import Image
import torch
from torchvision import transforms, datasets
import numpy as np
import os
```
# Path Definition
```
dataset_path = '../Dataset/emotiw/'
face_coordinates_directory = '.... | github_jupyter |
```
# !pip install plotly
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout
from sklearn.metr... | github_jupyter |
```
# change to root directory of project
import os
os.chdir('/home/tm/sciebo/corona/twitter_analysis/')
from bld.project_paths import project_paths_join as ppj
from IPython.display import display
import numpy as np
import pandas as pd
from sklearn.metrics import classification_report
from sklearn.metrics import conf... | github_jupyter |
# Table of Contents
<p><div class="lev2 toc-item"><a href="#Common-Layers" data-toc-modified-id="Common-Layers-01"><span class="toc-item-num">0.1 </span>Common Layers</a></div><div class="lev3 toc-item"><a href="#Convolution-Layers" data-toc-modified-id="Convolution-Layers-011"><span class="toc-item-num">0.... | github_jupyter |
```
import numpy as np # biblioteca utilizada para tratar com número/vetores/matrizes
import matplotlib.pyplot as plt # utilizada para plotar gráficos ao "estilo" matlab
import pandas as pd #biblioteca utilizada para realizar operações sobre dataframes
from google.colab import files #biblioteca do google colab utili... | github_jupyter |
# Twitter Sentiment Analysis for Indian Election 2019
**Abstract**<br>
The goal of this project is to do sentiment analysis for the Indian Elections. The data used is the tweets that are extracted from Twitter. The BJP and Congress are the two major political parties that will be contesting the election. The dataset w... | github_jupyter |
# Using geoprocessing tools
In ArcGIS API for Python, geoprocessing toolboxes and tools within them are represented as Python module and functions within that module. To learn more about this organization, refer to the page titled [Accessing geoprocessing tools](https://developers.arcgis.com/python/guide/accessing-geo... | github_jupyter |
### Creating Data Frames
documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html
DataFrame is a 2-dimensional labeled data structure with columns of potentially different types. You can think of it
like a spreadsheet or SQL table, or a dict of Series objects.
You can create a data f... | github_jupyter |
# Chapter 10 - Predicting Continuous Target Variables with Regression Analysis
### Overview
- [Introducing a simple linear regression model](#Introducing-a-simple-linear-regression-model)
- [Exploring the Housing Dataset](#Exploring-the-Housing-Dataset)
- [Visualizing the important characteristics of a dataset](#Vi... | github_jupyter |
# Loss Functions
This python script illustrates the different loss functions for regression and classification.
We start by loading the ncessary libraries and resetting the computational graph.
```
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
ops.reset_default_g... | github_jupyter |
##### Copyright 2019 The TensorFlow Authors.
```
#@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 ... | github_jupyter |
### Entrepreneurial Competency Analysis and Predict
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib as mat
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
data = pd.read_csv('entrepreneurial competency.csv')
data.head()
data.describe()
data.corr()
li... | github_jupyter |
# Mean Shift using Standard Scaler
This Code template is for the Cluster analysis using a simple Mean Shift(Centroid-Based Clustering using a flat kernel) Clustering algorithm along with feature scaling using Standard Scaler and includes 2D and 3D cluster visualization of the Clusters.
### Required Packages
```
!pip... | github_jupyter |
```
import pickle
import matplotlib.pyplot as plt
from scipy.stats.mstats import gmean
import seaborn as sns
from statistics import stdev
from math import log
import numpy as np
from scipy import stats
%matplotlib inline
price_100c = pickle.load(open("total_price_non.p","rb"))
price_100 = pickle.load(open("C:\\Users\\y... | github_jupyter |
# Learning a LJ potential [](https://colab.research.google.com/github/Teoroo-CMC/PiNN/blob/master/docs/notebooks/Learn_LJ_potential.ipynb)
This notebook showcases the usage of PiNN with a toy problem of learning a Lennard-Jones
potential with a... | github_jupyter |
<h1><center>Assessmet 5 on Advanced Data Analysis using Pandas</center></h1>
## **Project 2: Correlation Between the GDP Rate and Unemployment Rate (2019)**
```
import warnings
warnings.simplefilter('ignore', FutureWarning)
import pandas as pd
pip install pandas_datareader
```
# Getting the Datasets
We got the tw... | github_jupyter |
# T1557.001 - LLMNR/NBT-NS Poisoning and SMB Relay
By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials.
Link-Local Multicast N... | github_jupyter |
<a href="https://colab.research.google.com/github/yohanesnuwara/66DaysOfData/blob/main/D01_PCA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Principal Component Analysis
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd... | github_jupyter |
##### Copyright 2019 The TensorFlow Authors.
```
#@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 ... | github_jupyter |
# Lecture 10 - eigenvalues and eigenvectors
An eigenvector $\boldsymbol{x}$ and corrsponding eigenvalue $\lambda$ of a square matrix $\boldsymbol{A}$ satisfy
$$
\boldsymbol{A} \boldsymbol{x} = \lambda \boldsymbol{x}
$$
Rearranging this expression,
$$
\left( \boldsymbol{A} - \lambda \boldsymbol{I}\right) \boldsymbol... | github_jupyter |
<a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png"></a>
# Components for modeling overland flow erosion
*(G.E. Tucker, July 2021)*
There are two related components that calculate erosion resulting from surface-water flow, a.k.a. overland flow: `DepthSlopeProductErosion` an... | github_jupyter |
# Evolution of CRO disclosure over time
```
import sys
import math
from datetime import date
from dateutil.relativedelta import relativedelta
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates
from matplotlib.ticker import MaxNLocator
import seaborn as sns
sys.path.append... | github_jupyter |
# Lesson 3. Coordinate Reference Systems (CRS) & Map Projections
Building off of what we learned in the previous notebook, we'll get to understand an integral aspect of geospatial data: Coordinate Reference Systems.
- 3.1 California County Shapefile
- 3.2 USA State Shapefile
- 3.3 Plot the Two Together
- 3.4 Coordina... | github_jupyter |
**Estimación puntual**
```
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
import random
import math
np.random.seed(2020)
population_ages_1 = stats.poisson.rvs(loc = 18, mu = 35, size = 1500000)
population_ages_2 = stats.poisson.rvs(loc = 18, mu = 10, size = 1000000)
... | github_jupyter |
# Approximate q-learning
In this notebook you will teach a lasagne neural network to do Q-learning.
__Frameworks__ - we'll accept this homework in any deep learning framework. For example, it translates to TensorFlow almost line-to-line. However, we recommend you to stick to theano/lasagne unless you're certain about... | github_jupyter |
<a href="https://colab.research.google.com/github/dhruvsheth-ai/hydra-openvino-sensors/blob/master/hydra_openvino_pi.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
**Install the latest OpenVino for Raspberry Pi OS package from Intel OpenVino Distri... | github_jupyter |
<a href="https://colab.research.google.com/github/RichardFreedman/CRIM_Collab_Notebooks/blob/main/CRIM_Data_Search.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import requests
import pandas as pd
```
# Markdown for descriptive text
## level ... | github_jupyter |
# Importing the libraries
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn.metrics import roc_curve, auc
from sklearn.metrics import roc_auc_score,recall_score, precision_score, f1_score
from sklearn.metrics import accuracy_score, confusion_matrix, clas... | github_jupyter |
```
# default_exp callback.PredictionDynamics
```
# PredictionDynamics
> Callback used to visualize model predictions during training.
This is an implementation created by Ignacio Oguiza (timeseriesAI@gmail.com) based on a [blog post](http://localhost:8888/?token=83bca9180c34e1c8991886445942499ee8c1e003bc0491d0) by ... | github_jupyter |
# Homework03: Topic Modeling with Latent Semantic Analysis
Latent Semantic Analysis (LSA) is a method for finding latent similarities between documents treated as a bag of words by using a low rank approximation. It is used for document classification, clustering and retrieval. For example, LSA can be used to search ... | github_jupyter |
<a href="https://colab.research.google.com/github/ipavlopoulos/toxic_spans/blob/master/ToxicSpans_SemEval21.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Download the data and the code
```
from ast import literal_eval
import pandas as pd
import... | github_jupyter |
# Quickstart
A quick introduction on how to use the OQuPy package to compute the dynamics of a quantum system that is possibly strongly coupled to a structured environment. We illustrate this by applying the TEMPO method to the strongly coupled spin boson model.
**Contents:**
* Example - The spin boson model
* 1.... | github_jupyter |
<img src='./img/EU-Copernicus-EUM_3Logos.png' alt='Logo EU Copernicus EUMETSAT' align='right' width='50%'></img>
<br>
<br>
<a href="./index_ltpy.ipynb"><< Index</a><span style="float:right;"><a href="./12_ltpy_WEkEO_harmonized_data_access_api.ipynb">12 - WEkEO Harmonized Data Access API >></a></span>
# 1.1 Atmospher... | github_jupyter |
```
from erddapy import ERDDAP
import pandas as pd
import numpy as np
## settings (move to yaml file for routines)
server_url = 'http://akutan.pmel.noaa.gov:8080/erddap'
maxdepth = 0 #keep all data above this depth
site_str = 'M8'
region = 'bs'
substring = ['bs8','bs8'] #search substring useful for M2
prelim=[]
#this... | github_jupyter |
### Plot Comulative Distribution Of Sportive Behavior Over Time
```
%load_ext autoreload
%autoreload 2
%matplotlib notebook
from sensible_raw.loaders import loader
from world_viewer.cns_world import CNSWorld
from world_viewer.synthetic_world import SyntheticWorld
from world_viewer.glasses import Glasses
import matplot... | github_jupyter |
# PCMark benchmark on Android
The goal of this experiment is to run benchmarks on a Pixel device running Android with an EAS kernel and collect results. The analysis phase will consist in comparing EAS with other schedulers, that is comparing *sched* governor with:
- interactive
- performance
- powersave
... | github_jupyter |
## Exercise 3
In the videos you looked at how you would improve Fashion MNIST using Convolutions. For your exercise see if you can improve MNIST to 99.8% accuracy or more using only a single convolutional layer and a single MaxPooling 2D. You should stop training once the accuracy goes above this amount. It should happ... | github_jupyter |
# Distributing standardized COMBINE archives with Tellurium
<div align='center'><img src="https://raw.githubusercontent.com/vporubsky/tellurium-libroadrunner-tutorial/master/tellurium-and-libroadrunner.png" width="60%" style="padding: 20px"></div>
<div align='center' style='font-size:100%'>
Veronica L. Porubsky, BS
<d... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
```
#@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 ... | github_jupyter |
# Build Clause Clusters with Book Boundaries
```
from tf.app import use
bhsa = use('bhsa')
F, E, T, L = bhsa.api.F, bhsa.api.E, bhsa.api.T, bhsa.api.L
from pathlib import Path
# divide texts evenly into slices of 50 clauses
def cluster_clauses(N):
clusters = []
for book in F.otype.s('book'):
... | github_jupyter |
## TODO
* Add O2C and C2O seasonality
* Look at diff symbols
* Look at fund flows
## Key Takeaways
* ...
In the [first post](sell_in_may.html) of this short series, we covered several seasonality patterns for large cap equities (i.e, SPY), most of which continue to be in effect.
The findings of that exercise spar... | github_jupyter |
## AI for Medicine Course 1 Week 1 lecture exercises
<a name="densenet"></a>
# Densenet
In this week's assignment, you'll be using a pre-trained Densenet model for image classification.
Densenet is a convolutional network where each layer is connected to all other layers that are deeper in the network
- The first l... | github_jupyter |
Simple testing of FBT in Warp. Just transform beam in a drift. No solenoid included and no inverse transform.
```
%matplotlib notebook
import sys
del sys.argv[1:]
from warp import *
from warp.data_dumping.openpmd_diag import particle_diag
import numpy as np
import os
from copy import deepcopy
import matplotlib.pyplot ... | github_jupyter |
### Deep learning for identifying the orientation Scanned images
First we will load the train and test data and create a CTF file
```
import os
from PIL import Image
import numpy as np
import itertools
import random
import time
import matplotlib.pyplot as plt
import cntk as C
def split_line(line):
splits = lin... | github_jupyter |
# Adversarial Attacks Example in PyTorch
## Import Dependencies
This section imports all necessary libraries, such as PyTorch.
```
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
from torchvision import datasets, ... | github_jupyter |
[**Blueprints for Text Analysis Using Python**](https://github.com/blueprints-for-text-analytics-python/blueprints-text)
Jens Albrecht, Sidharth Ramachandran, Christian Winkler
**If you like the book or the code examples here, please leave a friendly comment on [Amazon.com](https://www.amazon.com/Blueprints-Text-Ana... | github_jupyter |
# PixelCNN
**Author:** [ADMoreau](https://github.com/ADMoreau)<br>
**Date created:** 2020/05/17<br>
**Last modified:** 2020/05/23<br>
**Description:** PixelCNN implemented in Keras.
## Introduction
PixelCNN is a generative model proposed in 2016 by van den Oord et al.
(reference: [Conditional Image Generation with P... | github_jupyter |
# "Poleval 2021 through wav2vec2"
> "Trying for pronunciation recovery"
- toc: false
- branch: master
- comments: true
- hidden: true
- categories: [wav2vec2, poleval, colab]
```
%%capture
!pip install gdown
!gdown https://drive.google.com/uc?id=1b6MyyqgA9D1U7DX3Vtgda7f9ppkxjCXJ
%%capture
!tar zxvf poleval_wav.train... | github_jupyter |
# Tune a CNN on MNIST
This tutorial walks through using Ax to tune two hyperparameters (learning rate and momentum) for a PyTorch CNN on the MNIST dataset trained using SGD with momentum.
```
import torch
import numpy as np
from ax.plot.contour import plot_contour
from ax.plot.trace import optimization_trace_single_... | github_jupyter |
```
#import sys
#!{sys.executable} -m pip install --user alerce
```
# light_transient_matching
## Matches DESI observations to ALERCE and DECAM ledger objects
This code predominately takes in data from the ALERCE and DECAM ledger brokers and identifies DESI observations within 2 arcseconds of those objects, suspected... | github_jupyter |
##### Copyright 2021 The TF-Agents Authors.
```
#@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 a... | github_jupyter |
# Titania = CLERK MOTEL
On Bumble, the Queen of Fairies and the Queen of Bees got together to find some other queens.
* Given
* Queen of Fairies
* Queen of Bees
* Solutions
* C [Ellery Queen](https://en.wikipedia.org/wiki/Ellery_Queen) = TDDTNW M UPZTDO
* L Queen of Hearts = THE L OF HEARTS
* E Queen Elizabe... | github_jupyter |
# Contrasts Overview
```
from __future__ import print_function
import numpy as np
import statsmodels.api as sm
```
This document is based heavily on this excellent resource from UCLA http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm
A categorical variable of K categories, or levels, usually enters a regress... | github_jupyter |
# Gym environment with scikit-decide tutorial: Continuous Mountain Car
In this notebook we tackle the continuous mountain car problem taken from [OpenAI Gym](https://gym.openai.com/), a toolkit for developing environments, usually to be solved by Reinforcement Learning (RL) algorithms.
Continuous Mountain Car, a sta... | github_jupyter |
```
import tensorflow as tf
import numpy as np
import tsp_env
def attention(W_ref, W_q, v, enc_outputs, query):
with tf.variable_scope("attention_mask"):
u_i0s = tf.einsum('kl,itl->itk', W_ref, enc_outputs)
u_i1s = tf.expand_dims(tf.einsum('kl,il->ik', W_q, query), 1)
u_is = tf.einsum('k,itk... | github_jupyter |
<div align="right"><i>COM418 - Computers and Music</i></div>
<div align="right"><a href="https://people.epfl.ch/paolo.prandoni">Lucie Perrotta</a>, <a href="https://www.epfl.ch/labs/lcav/">LCAV, EPFL</a></div>
<p style="font-size: 30pt; font-weight: bold; color: #B51F1F;">Channel Vocoder</p>
```
%matplotlib inline
im... | github_jupyter |
Authored by: Avani Gupta <br>
Roll: 2019121004
**Note: dataset shape is version dependent hence final answer too will be dependent of sklearn version installed on machine**
# Excercise: Eigen Face
Here, we will look into ability of PCA to perform dimensionality reduction on a set of Labeled Faces in the Wild dat... | github_jupyter |
<div align="center">
<h1><img width="30" src="https://madewithml.com/static/images/rounded_logo.png"> <a href="https://madewithml.com/">Made With ML</a></h1>
Applied ML · MLOps · Production
<br>
Join 30K+ developers in learning how to responsibly <a href="https://madewithml.com/about/">deliver value</a> with ML.
... | github_jupyter |
# Expressions and Arithmetic
**CS1302 Introduction to Computer Programming**
___
## Operators
The followings are common operators you can use to form an expression in Python:
| Operator | Operation | Example |
| --------: | :------------- | :-----: |
| unary `-` | Negation | `-y` |
| `+` | Addi... | github_jupyter |
```
%matplotlib inline
from IPython import display
import matplotlib.pyplot as plt
import torch
from torch import nn
import torchvision
import torchvision.transforms as transforms
import time
import sys
sys.path.append("../")
import d2lzh1981 as d2l
from tqdm import tqdm
print(torch.__version__)
print(torchvision._... | github_jupyter |
```
import os
import numpy as np
np.random.seed(0)
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import set_config
set_config(display="diagram")
DATA_PATH = os.path.abspath(
r"C:\Users\jan\Dropbox\_Coding\UdemyML\Chapter13_CaseStudies\CaseStudyIncome\adult.xlsx"
)
```
### Dataset
```
df = pd.re... | github_jupyter |
# UK research networks with HoloViews+Bokeh+Datashader
[Datashader](http://datashader.readthedocs.org) makes it possible to plot very large datasets in a web browser, while [Bokeh](http://bokeh.pydata.org) makes those plots interactive, and [HoloViews](http://holoviews.org) provides a convenient interface for building... | github_jupyter |
<img src="images/utfsm.png" alt="" width="100px" align="right"/>
# USM Numérica
## Licencia y configuración del laboratorio
Ejecutar la siguiente celda mediante *`Ctr-S`*.
```
"""
IPython Notebook v4.0 para python 3.0
Librerías adicionales:
Contenido bajo licencia CC-BY 4.0. Código bajo licencia MIT.
(c) Sebastian ... | github_jupyter |
# Prudential Life Insurance Assessment
An example of the structured data lessons from Lesson 4 on another dataset.
```
%reload_ext autoreload
%autoreload 2
%matplotlib inline
import os
from pathlib import Path
import pandas as pd
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
f... | github_jupyter |
Carbon Insight: Carbon Emissions Visualization
==============================================
This tutorial aims to showcase how to visualize anthropogenic CO2 emissions with a near-global coverage and track correlations between global carbon emissions and socioeconomic factors such as COVID-19 and GDP.
```
# Require... | github_jupyter |
```
from sklearn.model_selection import train_test_split
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
from datetime import datetime
import bert
from bert import run_classifier
from bert import optimization
from bert import tokenization
from tensorflow import keras
import os
import re
# Set t... | github_jupyter |
# Homework 2 - Deep Learning
## Liberatori Benedetta
```
import torch
import numpy as np
# A class defining the model for the Multi Layer Perceptron
class MLP(torch.nn.Module):
def __init__(self):
super().__init__()
self.layer1 = torch.nn.Linear(in_features=6, out_features=2, bias= True)
s... | github_jupyter |
# Logistic Regression with a Neural Network mindset
Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning.... | github_jupyter |
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from loglizer.models import SVM
from loglizer import dataloader, preprocessing
import numpy as np
struct_log = '../data/HDFS/HDFS_100k.log_structured.csv' # The structured log file
label_file = '../data/HDFS/anomaly_label.csv' # The a... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data=pd.read_csv('F:\\bank-additional-full.csv',sep=';')
data.shape
tot=len(set(data.index))
last=data.shape[0]-tot
last
data.isnull().sum()
print(data.y.value_counts())
sns.countplot(x='y', data=data)
plt.show()
cat=data.s... | github_jupyter |
# Revisiting Lambert's problem in Python
```
import numpy as np
import matplotlib.pyplot as plt
from cycler import cycler
from poliastro.core import iod
from poliastro.iod import izzo
plt.ion()
plt.rc('text', usetex=True)
```
## Part 1: Reproducing the original figure
```
x = np.linspace(-1, 2, num=1000)
M_list = ... | github_jupyter |
# GLM: Negative Binomial Regression
```
%matplotlib inline
import numpy as np
import pandas as pd
import pymc3 as pm
from scipy import stats
import matplotlib.pyplot as plt
plt.style.use('seaborn-darkgrid')
import seaborn as sns
import re
print('Running on PyMC3 v{}'.format(pm.__version__))
```
This notebook demos ne... | github_jupyter |
# Multi-qubit quantum circuit
In this exercise we creates a two qubit circuit, with two qubits in superposition, and then measures the individual qubits, resulting in two coin toss results with the following possible outcomes with equal probability: $|00\rangle$, $|01\rangle$, $|10\rangle$, and $|11\rangle$. This is li... | github_jupyter |
# Twitter Mining Function & Scatter Plots
---------------------------------------------------------------
```
# Import Dependencies
%matplotlib notebook
import os
import csv
import json
import requests
from pprint import pprint
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from twython import ... | github_jupyter |
# Simulating Power Spectra
In this notebook we will explore how to simulate the data that we will use to investigate how different spectral parameters can influence band ratios.
Simulated power spectra will be created with varying aperiodic and periodic parameters, and are created using the [FOOOF](https://github.co... | github_jupyter |
# Symbolic System
Create a symbolic three-state system:
```
import markoviandynamics as md
sym_system = md.SymbolicDiscreteSystem(3)
```
Get the symbolic equilibrium distribution:
```
sym_system.equilibrium()
```
Create a symbolic three-state system with potential energy barriers:
```
sym_system = md.SymbolicDisc... | github_jupyter |
# Version information
```
from datetime import date
print("Running date:", date.today().strftime("%B %d, %Y"))
import pyleecan
print("Pyleecan version:" + pyleecan.__version__)
import SciDataTool
print("SciDataTool version:" + SciDataTool.__version__)
```
# How to define a machine
This tutorial shows the different ... | github_jupyter |
## 练习 1:写程序,可由键盘读入用户姓名例如Mr. right,让用户输入出生的月份与日期,判断用户星座,假设用户是金牛座,则输出,Mr. right,你是非常有性格的金牛座!。
```
name = input('请输入你的姓名')
print('你好',name)
print('请输入出生的月份与日期')
month = int(input('月份:'))
date = int(input('日期:'))
if month == 4:
if date < 20:
print(name, '你是白羊座')
else:
print(name,'你是非常有性格的金牛座')
... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.stats as sts
import seaborn as sns
sns.set()
%matplotlib inline
```
# 01. Smooth function optimization
Рассмотрим все ту же функцию из задания по линейной алгебре:
$ f(x) = \sin{\frac{x}{5}} * e^{\frac{... | github_jupyter |
# Mount Drive
```
from google.colab import drive
drive.mount('/content/drive')
!pip install -U -q PyDrive
!pip install httplib2==0.15.0
import os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from pydrive.files import GoogleDriveFileList
from google.colab import auth
from oauth2client.clien... | github_jupyter |
# Analyzing data with Dask, SQL, and Coiled
In this notebook, we look at using [Dask-SQL](https://dask-sql.readthedocs.io/en/latest/), an exciting new open-source library which adds a SQL query layer on top of Dask. This allows you to query and transform Dask DataFrames using common SQL operations.
## Launch a cluste... | github_jupyter |
```
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras import layers
import tensorflow.keras.backend as keras_backend
tf.keras.backend.set_floatx('float32')
import tensorflow_probability as tfp
f... | github_jupyter |
<a href="https://colab.research.google.com/github/gpdsec/Residual-Neural-Network/blob/main/Custom_Resnet_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
*It's custom ResNet trained demonstration purpose, not for accuracy.
Dataset used is cats_vs_d... | github_jupyter |
```
import geopandas as gpd
import pandas as pd
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import tarfile
from discretize import TensorMesh
from SimPEG.utils import plot2Ddata, surface2ind_topo
from SimPEG.potential_fields import gravity
from SimPEG import (
maps,
d... | github_jupyter |
# Overview
In this project, I will build an item-based collaborative filtering system using [MovieLens Datasets](https://grouplens.org/datasets/movielens/latest/). Specically, I will train a KNN models to cluster similar movies based on user's ratings and make movie recommendation based on similarity score of previous... | github_jupyter |
Quick study to investigate oscillations in reported infections in Germany. Here is the plot of the data in question:
```
import coronavirus
import numpy as np
import matplotlib.pyplot as plt
%config InlineBackend.figure_formats = ['svg']
coronavirus.display_binder_link("2020-05-10-notebook-weekly-fluctuations-in-data... | github_jupyter |
```
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import GridSearchCV
from sklearn... | github_jupyter |
---
_You are currently looking at **version 1.0** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-text-mining/resources/d9pwm) course resource._
---
# Assignment 2 - Introd... | github_jupyter |
Evaluating performance of FFT2 and IFFT2 and checking for accuracy. <br><br>
Note that the ffts from fft_utils perform the transformation in place to save memory.<br><br>
As a rule of thumb, it's good to increase the number of threads as the size of the transform increases until one hits a limit <br><br>
pyFFTW uses lo... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import warnings
warnings.filterwarnings('ignore')
import math
from time import time
import pickle
import pandas as pd
import numpy as np
from time import time
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import BaggingClassifier
from sklearn.metrics imp... | github_jupyter |
```
import numpy as np
import tensorflow as tf
from sklearn.utils import shuffle
import re
import time
import collections
import os
def build_dataset(words, n_words, atleast=1):
count = [['PAD', 0], ['GO', 1], ['EOS', 2], ['UNK', 3]]
counter = collections.Counter(words).most_common(n_words)
counter = [i for... | github_jupyter |
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_12_04_atari.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# T81-558: Applications of Deep Neural Networks
**Module 12: Reinforcement Learn... | github_jupyter |
# Disclaimer
Released under the CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
# Purpose of this notebook
The purpose of this document is to show how I approached the presented problem and to record my learning experience in how to use Tensorflow 2 and CatBoost to perform a classification task on t... | github_jupyter |
## Data Description and Analysis
```
import numpy as np
import pandas as pd
pd.set_option('max_columns', 150)
import gc
import os
# matplotlib and seaborn for plotting
import matplotlib
matplotlib.rcParams['figure.dpi'] = 120 #resolution
matplotlib.rcParams['figure.figsize'] = (8,6) #figure size
import matplotlib.p... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.