Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# =============================================================================
# Version: 2.32 (Apr 26, 2015)
# Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa
#
# Contributors:
# Antonio Fuschetto (fuschett@aol.com)
# Leonardo Souza (lsouza@amtera.com.br)
@VinGorilla
VinGorilla / LDA_SparkDocs
Last active August 29, 2015 14:27 — forked from jkbradley/LDA_SparkDocs
LDA Example: Modeling topics in the Spark documentation
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable
import re
def glob2re(pat):
"""Translate a shell PATTERN to a regular expression.
There is no way to quote meta-characters.
"""
i, n = 0, len(pat)
res = ''
alias em="emacs"
alias ll="ls -al"
alias py="python"
alias gwe="grep -rnw . -e"
alias fe="find . -name"
alias c="cd"
alias gits="git status"
alias gitl="git log"
alias gitpull="git pull origin master"
{
"product": "Live JSON generator",
"version": 3.1,
"releaseDate": "2014-06-25T00:00:00.000Z",
"demo": true,
"person": {
"id": 12345,
"name": "John Doe",
"phones": {
"home": "800-123-4567",
@VinGorilla
VinGorilla / lstm-lm.py
Last active August 29, 2015 14:11 — forked from neubig/lstm-lm.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simplified implementation of the LSTM language model (by Graham Neubig)
#
# LSTM Neural Networks for Language Modeling
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney
# InterSpeech 2012
#
# The structure of the model is extremely simple. At every time step we
#!/bin/bash
 
WORK_PATH=/home/yangshuang/hadoop/hadooptestdir #本地文件目录
HADOOP_CLIENT_PATH=/home/yangshuang/hadoop-client/hadoop    #客户端目录
HADOOP_CLIENT_BIN=${HADOOP_CLIENT_PATH}/bin/hadoop  #客户端可执行程序
HADOOP_CLIENT_CONF=${HADOOP_CLIENT_PATH}/conf/hadoop-site-xxx.xml   #客户端配置文件
HDFS_ROOT=/app/vs/ns-webgis #HDFS目录
HDFS_IN_PATH=${HDFS_ROOT}/data/ys   #HDFS目录
HDFS_OUT_PATH=${HDFS_IN_PATH}/testdir   #HDFS输出位置
INPUT=${HDFS_IN_PATH}/input #HDFS输入
$brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 7cb9a9fa0de88230bbe9b5e3bc61ea30b6e88c84
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit haswell
OS X: 10.9.4-x86_64
Xcode: 4.6.3
Clang: 4.2 build 425
import numpy as np
import pandas as pd
import statsmodels.formula.api as sm #lin reg
import pylab as py
import matplotlib as mp
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.ensemble import RandomForestRegressor
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""