This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
from datetime import datetime, timedelta | |
from algorithm import test | |
default_args = { | |
"owner": "airflow", | |
"depends_on_past": False, | |
"start_date": datetime(2015, 6, 1), | |
"email": ["airflow@airflow.com"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.callbacks import ModelCheckpoint | |
# checkpoint | |
filepath="weights.best.hdf5" | |
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max') | |
callbacks_list = [checkpoint] | |
batch_size = 512 | |
history = model.fit(partial_X_train, | |
partial_Y_train, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#####!/usr/bin/env /bin/bash | |
#! /bin/bash | |
INDEX_NAME="tweet-classification" | |
curl -XPUT "http://localhost:9200/$INDEX_NAME/" -d '{ | |
"settings": { | |
"number_of_shards": 2, | |
"number_of_replicas": 1 | |
}, | |
"mappings": { | |
"classified-tweet": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import load_model | |
def load_nn(nn_hdf5_filename): | |
model = load_model(nn_hdf5_filename) | |
return model | |
def main(): | |
#load neural network model | |
model = load_nn('weights.best.hdf5') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base image | |
FROM python:3.6 | |
# updating repository | |
RUN apt-get update | |
# copying requirements.txt file | |
COPY requirements.txt requirements.txt | |
# pip install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ## Sentiment analysis | |
# In[12]: | |
import nltk | |
# In[8]: | |
nltk.download("punkt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# In[1]: | |
import pandas as pd | |
import numpy as np | |
# In[2]: | |
#Read the dataset in csv | |
tweets = pd.read_csv('./twitter-airline-sentiment/Tweets.csv', sep=',') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import tensorflow as tf | |
import pandas as pd | |
import csv | |
num_clusters = 4 | |
num_steps = 100 | |
num_vectors = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
private static final Singleton instance = new Singleton(); | |
public static Singleton getInstance() { return instance; } | |
private Singleton() {} | |
} |