Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
import pandas as pd | |
data = pd.read_csv("file.csv", sep=",") | |
print(data.head(2)) | |
with open('file.json', 'w') as f: | |
f.write(data.to_json(orient='records', lines=True)) | |
# check | |
data = pd.read_json("file.json", lines=True) | |
print(data.head(2)) |
#! encoding=UTF-8 | |
""" | |
kernel canonical correlation analysis | |
""" | |
import numpy as np | |
from scipy.linalg import svd | |
from sklearn.metrics.pairwise import pairwise_kernels, euclidean_distances | |
class KCCA(object): |
class AttentionWithContext(Layer): | |
""" | |
Attention operation, with a context/query vector, for temporal data. | |
Supports Masking. | |
Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] | |
"Hierarchical Attention Networks for Document Classification" | |
by using a context vector to assist the attention | |
# Input shape | |
3D tensor with shape: `(samples, steps, features)`. | |
# Output shape |
Sentiment analysis experiment using scikit-learn | |
================================================ | |
The script sentiment.py reproduces the sentiment analysis approach from Pang, | |
Lee and Vaithyanathan (2002), who tried to classify movie reviews as positive | |
or negative, with three differences: | |
* tf-idf weighting is applied to terms | |
* the three-fold cross validation split is different | |
* regularization is tuned by cross validation |
package codepath.com.recyclerviewfun; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Contact { | |
private String mName; | |
private boolean mOnline; | |
public Contact(String name, boolean online) { |
#!/bin/bash | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
apt-get install pkg-config libmagickwand-dev -y | |
cd /tmp | |
wget https://pecl.php.net/get/imagick-3.4.0.tgz | |
tar xvzf imagick-3.4.0.tgz |
package br.com.toptarget.topvagas.helper; | |
import android.content.Context; | |
import android.graphics.drawable.Drawable; | |
import android.os.AsyncTask; | |
import android.text.Html; | |
import android.util.Log; | |
import android.view.View; | |
import org.apache.http.HttpResponse; |
Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.
import os | |
import sys | |
# Install venv by `virtualenv --distribute venv` | |
# Then install depedencies: `source venv/bin/active` | |
# `pip install -r requirements.txt` | |
activate_this = '/var/www/apache/csshat.com/csshat.com/venv/bin/activate_this.py' | |
execfile(activate_this, dict(__file__=activate_this)) | |
path = os.path.join(os.path.dirname(__file__), os.pardir) |