This file contains hidden or 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 pandas as pd | |
import seaborn as sns | |
data = pd.read_csv('C:\work\ML\Advertising.csv', index_col= 0) | |
print(data.head()) | |
%matplotlib inline | |
#sns.pairplot (data, x_vars=['TV','Radio','Newspaper'], y_vars='Sales') | |
#feature_cols =['TV','Radio','Newspaper'] | |
#print(feature_cols) | |
X = data[['TV','Radio','Newspaper']] |
This file contains hidden or 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 sklearn.cross_validation import train_test_split | |
from sklearn.datasets import load_iris | |
from sklearn.linear_model import LogisticRegression | |
from sklearn import metrics | |
from sklearn.neighbors import KNeighborsClassifier | |
iris = load_iris() | |
X = iris.data | |
y = iris.target | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4 ) |
This file contains hidden or 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 sklearn import metrics | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.datasets import load_iris | |
iris = load_iris() | |
X = iris.data | |
y = iris.target | |
logreg = LogisticRegression() |
This file contains hidden or 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 sklearn.datasets import load_iris | |
from sklearn.linear_model import LogisticRegression | |
iris = load_iris() | |
X = iris.data | |
y = iris.target | |
logreg = LogisticRegression() | |
logreg.fit(X,y) | |
logreg.predict(X[0]) |
This file contains hidden or 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 sklearn.datasets import load_iris | |
from sklearn.neighbors import KNeighborsClassifier | |
#Load the data | |
iris = load_iris() | |
type(iris) | |
print(iris) | |
print( iris.feature_names) | |
print(iris.target) |
This file contains hidden or 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
select lo.*, | |
a.sql_text | |
from gv$sqlarea a, gv$session_longops lo | |
where lo.sql_id = a.sql_id | |
order by lo.start_time; | |
select s.sid, | |
s.username, | |
s.machine, |
This file contains hidden or 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
# Spark ML example | |
# Here is the code URL (courtesy): https://github.com/jayantshekhar/strata-2016/blob/master/src/main/scala/com/cloudera/spark/spamdetection/Spam.scala | |
------------------------ | |
// scalastyle:off println | |
package com.cloudera.spark.spamdetection | |
import scala.beans.BeanInfo | |
import org.apache.spark.{SparkConf, SparkContext} |
This file contains hidden or 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
package kafkaHome; | |
import java.util.Properties; | |
//import org.apache.kafka.clients.producer.KafkaProducer; | |
import org.apache.kafka.clients.producer.*; | |
//import org.apache.kafka.clients.producer.ProducerRecord; | |
//import org.apache.kafka.clients.producer.RecordMetadata; | |
public class SimpleProducer { |
This file contains hidden or 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
env # to get all env variables | |
#Find class files in a jar | |
all_hdp_classes () { | |
find -L /usr/hdp/current -maxdepth 20 -name "*.jar" -print | while read line; do | |
for i in `jar tf $line | grep .class` | |
do | |
echo $line : $i | |
done | |
done |
This file contains hidden or 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
// SHELL COMMANDS FROM SPARK SHELL | |
:sh hdfs dfs -ls /user/cloudera | |
<result> foreach println //use the result variable like 'res0' in the place of <result> |