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 numpy as np | |
| class matrix(state_seq): | |
| def __init__(self, state_sequence): | |
| """ | |
| state_sequence: array or list of integers representing state transitions | |
| """ | |
| self.state_seq = state_sequence | |
| self.n = max(state_sequence) + 1 |
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
| def damerau_levenshtein_distance(s1, s2): | |
| """ | |
| Like the Levenshtein Distance, this metric calculates the | |
| distance between 2 strings as a the number of single-character | |
| insertions, deletions, or substitutions that it takes to make | |
| the strings equivalent. However, in this case, transpositions | |
| are added into the list of available transformation operations. | |
| Source(s): |
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
| setClass("itemset", slots=c(id="character", support="numeric", tids="vector") | |
| ECLAT <- function(filename, minsupport, nfeatures, out=NULL){ | |
| .input <- read.csv(file = datafile, header=FALSE, sep = " ") | |
| .coninue <- TRUE | |
| .tids <- function(data, ){ | |
| itemsets = c() | |
| for (i in c(1:nfeatures)){ | |
| item.row.str = "" | |
| item.row.vec = vector() |
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
| 0,1 | |
| 1,3 | |
| 1,2 | |
| 2,4 | |
| 3,4 | |
| 4,5 | |
| 5,6 | |
| 6,7 | |
| 6,8 | |
| 7,8 |
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
| Harry | |
| Dave | |
| Sue | |
| Chuck | |
| Theo | |
| Clay | |
| Hugo | |
| Dan | |
| Kate | |
| Kip |
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
| def levenshtein_distance(s1, s2): | |
| """ | |
| Calculates the distance between 2 strings as a the number of single-character | |
| insertions, deletions, or substitutions that it takes to make | |
| the two strings equivalent. | |
| Source(s): | |
| (1) Levenshtein, Vladimir I. (February 1966). | |
| "Binary codes capable of correcting deletions, insertions, and reversals". | |
| Soviet Physics Doklady. 10 (8): 707–710. |
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
| /** | |
| Abstract storage containers. | |
| **/ | |
| public class storageContainer<E>{ | |
| private E[] storageSpace; | |
| public storageContainer(int size){ | |
| this.size = size | |
| storageSpace = (E[]) new Object[size]; | |
| } | |
| private void populateArray(int n){ |
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
| class CIK(object): | |
| def __init__(self, company, auto_select_result=0): | |
| self.params = {"company": company} | |
| self.url = "https://www.sec.gov/cgi-bin/cik_lookup" | |
| def _user_select(self, companies): | |
| print("Select item from results list using the integer located to the left of each row") | |
| selected = None | |
| info = [] | |
| for i in range(1, len(companies)): |
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 java.io.*; | |
| import java.util.Scanner; | |
| public class fileIO{ | |
| public static void writer(String target_dir; String file){ | |
| try | |
| { | |
| PrintWriter writer = new PrinterWriter(new FileOutputStream(target_dir + file)); | |
| } | |
| catch(FileNotFoundException e){ |
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
| public class capitalizeWord{ | |
| public static String main(String s){ | |
| String[] a = s.split(" "); | |
| for(int i=0; i<a.length; i++){ | |
| a[i] = a[i].substring(0, 1).toUppercase() + a[i].substring(1); | |
| } | |
| String r = ""; | |
| for(int i=0; i<a.length; i++){ | |
| r += a[i] + " "; | |
| } |
NewerOlder