Skip to content

Instantly share code, notes, and snippets.

@dilipbobby
dilipbobby / spark_cassandra.,py
Last active March 1, 2018 17:58
Integration code of pyspark with cassandra
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
conf = SparkConf()
conf.setMaster("local[4]")
conf.setAppName("Spark Cassandra")
conf.set("spark.cassandra.connection.host","127.0.0.1")
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)
@dilipbobby
dilipbobby / hi.py
Created January 26, 2018 04:05
hello
print("hello")
@dilipbobby
dilipbobby / loadModel.py
Created December 13, 2017 09:44 — forked from vgpena/loadModel.py
Basic text classification with Keras and TensorFlow
import json
import numpy as np
import keras
import keras.preprocessing.text as kpt
from keras.preprocessing.text import Tokenizer
from keras.models import model_from_json
# we're still going to use a Tokenizer here, but we don't need to fit it
tokenizer = Tokenizer(num_words=3000)
# for human-friendly printing
print("hello")
@dilipbobby
dilipbobby / MySpilt.java
Last active February 23, 2017 04:08
This code is a normal example for writing the split method and using it
public class MySplit {
public static String[] mySplit(String text, String delimiter) {
java.util.List<String> parts = new java.util.ArrayList<String>();
text += delimiter;
for (int i = text.indexOf(delimiter), j=0; i != -1;) {
String temp = text.substring(j,i);
if(temp.trim().length() != 0) {
@dilipbobby
dilipbobby / LatentDirichletAllocationTest.java
Created December 12, 2016 05:23
LatentDirichletAllocation test code.
import com.datumbox.framework.common.Configuration;
import com.datumbox.framework.common.dataobjects.Dataframe;
import com.datumbox.framework.common.dataobjects.Record;
import com.datumbox.framework.core.machinelearning.classification.SoftMaxRegression;
import com.datumbox.framework.core.machinelearning.topicmodeling.LatentDirichletAllocation;
import com.datumbox.framework.core.utilities.text.extractors.UniqueWordSequenceExtractor;
import java.io.UncheckedIOException;