Skip to content

Instantly share code, notes, and snippets.

View metasyn's full-sized avatar

Xander Johnson metasyn

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import splunk.Intersplunk
import exec_anaconda
try:
exec_anaconda.exec_anaconda()
except Exception as e:
import cexc
cexc.abort(e)
sys.exit(1)
import sys
import exec_anaconda
try:
exec_anaconda.exec_anaconda()
except Exception as e:
import cexc
cexc.abort(e)
sys.exit(1)
# Import this to get our "chunked" handler
from cexc import BaseChunkHandler

requirements

WORK IN PROGRESS

1.) Python for Scientific Computing App

2.) Splunk ML Toolkit >=1.0

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
demo@ip-10-0-0-200:/opt/splunk/bin$ ./splunk btool inputs list http --debug
/opt/splunk/etc/apps/splunk_httpinput/local/inputs.conf [http]
/opt/splunk/etc/apps/splunk_httpinput/default/inputs.conf dedicatedIoThreads = 2
/opt/splunk/etc/apps/splunk_httpinput/local/inputs.conf disabled = 0
/opt/splunk/etc/apps/splunk_httpinput/default/inputs.conf enableSSL = 1
host = splunk00
index = default
/opt/splunk/etc/apps/splunk_httpinput/default/inputs.conf maxSockets = 0
/opt/splunk/etc/apps/splunk_httpinput/default/inputs.conf maxThreads = 0
/opt/splunk/etc/apps/splunk_httpinput/default/inputs.conf port = 8088
#!/usr/bin/env python
import sys
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
import pandas as pd
import numpy as np

Customer Segmentation

This approach is taken directly from Chen, Sain, Guo (2012), and the data provided on the UCI Machine Learning Repository.

  • Limit time to January 1st - December 1st.
  • Add constaints to your search for United Kingdom, positive Quantity, positive UnitPrice, and a valid CustomerID

| search Country="United Kingdom" Quantity>0 UnitPrice>0 CustomerID=*

  • Calculate a monetary field by multiplying Quantity and UnitPrice
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.