Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PhanDuc
PhanDuc / working_with_google_ngram.ipynb
Created May 21, 2018 19:29
Experiment with Google Ngram
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class CaptionNet(nn.Module):
def __init__(self, n_tokens=n_tokens, emb_size=128, lstm_units=256, cnn_feature_size=2048):
""" A recurrent 'head' network for image captioning. See scheme above. """
super(self.__class__, self).__init__()
# a layer that converts conv features to
self.cnn_to_h0 = nn.Linear(cnn_feature_size, lstm_units)
self.cnn_to_c0 = nn.Linear(cnn_feature_size, lstm_units)
# recurrent part, please create the layers as per scheme above.
from sklearn.ensemble import BaggingClassifier
def bootstrap_predictions(estimator, X, y, X_test, n_bootstrap=101):
"""Bootstrap a given classifier.
Parameters
----------
estimator : object
A classifier instance with sklearn-compatible interface.
def nearest_neighbours(X, Y, norm=2.0):
"""Index the rows of `Y` in increasing order of distance from each row in `X`.
Parameters
----------
X : array, 2 dimensional, shape = (n_samples, n_dim)
The matrix, for the rows of which to find the closest row in `Y`.
Y : array, 2 dimensional, shape = (n_reference, n_dim)
The matrix, among the rows of which to seek the closest one for `X`.
import numpy as np
import scipy as sp
from numpy import random
from numpy import matlib
import matplotlib.pyplot as plt
from gurobipy import GRB
import gurobipy as grb
class Problem:
import pandas as pd
df = pd.read_excel('D:\\BILL THÁNG 1.xlsx')
du = df.ix[:, 4]
temp_list = []
for cell in du:
try:
ed = ''.join(cell.split(',')[-1])
print(ed)
temp_list.append(ed)
'use strict';
const apiai = require('apiai');
const config = require('./config');
const express = require('express');
const crypto = require('crypto');
const bodyParser = require('body-parser');
const request = require('request');
const app = express();
const uuid = require('uuid');