Skip to content

Instantly share code, notes, and snippets.

@parcmepperman
parcmepperman / DLICP_3_ICP_DL_3.1.py
Created July 11, 2018 21:33
Deep Learning ICP 3
import collections
import math
import os
import errno
import random
import zipfile
import numpy as np
from six.moves import urllib
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.6 (CS490)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
file = open('input.txt', 'r', encoding="utf-8")
text = file.read()
words = word_tokenize(text)
ps = PorterStemmer() # using the PorterStemmer toolkit to stem
for w in words:
print(ps.stem(w))
# ICP Day 6, Number 1
# import plug in
from sklearn import datasets
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import train_test_split
# declare iris, x/y variables, assign target and data
iris = datasets.load_iris()
x = iris.data
y = iris.target
# ICP Day 5, Problem 1
# plug ins, numpy, matplotlib for graphing
import numpy as np
import matplotlib.pyplot as p
# set array with the given integers
x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
y = np.array([1, 3, 2, 5, 7, 8, 8, 9, 10, 12])
# set mean, pass x,y
#comment where you use concepts
#ICP Day 4 # 1
# Create a class object for Employee
class Employee(object):
num_of_employees = 0 # initiate counter
#lab 1.3
# combo toolkit allows easy coding combinations, found after spending hours trying to
# hard code if statements, this is way easier
from itertools import combinations
# itertools uses the combinations to iterate through and find matches ([index], choose 3)
input_int = list(combinations([1, 3, 6, 2, -1, 2, 8, -2, 9], 3))
# variables, and index for parsing through the input_int
#Lab 1.1
#Take user input for password
user_pass = input("""
Enter a new password containing...
At least one upper(A),
one lower(a) case letter,
at least on character [$@!*],
and at least one digit (0-9): """)
#Lab 1.1