This file contains 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 static <T> boolean linearSearch(List<T> list, T t, LinearSearchMode<T> mode) { | |
if ((list == null) || (t == null)) { | |
return false; | |
} | |
for (int i = 0; i < list.size(); i++) { | |
if (list.get(i).equals(t)) { | |
if (mode != null) { | |
mode.moveElement(list, i); | |
} | |
return true; |
This file contains 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 LinearSearchModeFactory<T> { | |
public static final int modeMoveFirst = 1; | |
public static final int modeMoveLast = 2; | |
public static final int modeMoveUp = 3; | |
public static <T> LinearSearchMode<T> build(int mode) { | |
switch (mode) { | |
case modeMoveFirst: | |
return new LinearSearchModeMoveFirst<T>(); | |
case modeMoveLast: |
This file contains 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 interface LinearSearchMode<T> { | |
public void moveElement(List<T> list, int index); | |
} | |
class LinearSearchModeMoveFirst<T> implements LinearSearchMode<T> { | |
@Override | |
public void moveElement(List<T> list, int index) { | |
// Move element to the front of the list | |
T t = list.remove(index); | |
list.add(0, t); |
This file contains 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
// This is equivalent to: linearSearch(list, t, build(modeMoveFirst)) | |
public static <T> boolean linearSearchMoveFirst(List<T> list, T t) { | |
return linearSearch(list, t, | |
((List<T> l, int index) | |
-> { T elem = l.remove(index); l.add(0, elem); } )); | |
} | |
// This is equivalent to: linearSearch(list, t, build(modeMoveLast)) | |
public static <T> boolean linearSearchMoveLast(List<T> list, T t) { | |
return linearSearch(list, t, |
This file contains 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
lastname, firstname, gender, state, age, month, day, hour, minutes, items, basket | |
CROFFORD,LON,M,New Hampshire,75,4,41,17,15,3,824 | |
BLANZY,MARLON,M,Kansas,86,12,112,6,36,4,1468 | |
GILKEY,PALMER,M,South Carolina,86,5,16,5,53,7,2100 | |
INSOGNIA,KATERINE,F,U.S. Virgin Islands,76,2,299,21,4,9,2664 | |
CERVA,BOB,M,California,35,7,157,23,35,5,1101 | |
SHAHBAZ,KATHRINE,F,American Samoa,78,10,48,7,51,4,1210 |
This file contains 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
COPY mydata from 's3://jsimon-logs/data.txt' | |
CREDENTIALS 'aws_access_key_id=ACCESS_KEY_ID;aws_secret_access_key=ACCESS_KEY | |
DELIMITER ',' | |
REMOVEQUOTES | |
REGION 'eu-west-1’; |
This file contains 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
CREATE TABLE mydata | |
( | |
lastname VARCHAR(30) NOT NULL, | |
firstname VARCHAR(30) NOT NULL, | |
gender CHAR(1) NOT NULL, | |
state VARCHAR(30) NOT NULL, | |
age SMALLINT NOT NULL, | |
month SMALLINT NOT NULL, | |
day SMALLINT NOT NULL, | |
hour SMALLINT NOT NULL, |
This file contains 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
score | |
1.493473E3 | |
1.247774E3 | |
7.402291E2 | |
1.49587E3 | |
1.998012E3 | |
9.961498E2 | |
2.246854E3 | |
9.937198E2 | |
1.235804E3 |
This file contains 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
✗ aws machinelearning describe-ml-models | |
{ | |
"Results": [ | |
{ | |
"Status": "COMPLETED", | |
"SizeInBytes": 5821257, | |
"Name": "ML model: Data3.txt", | |
"TrainingParameters": { | |
"sgd.l2RegularizationAmount": "1e-6", | |
"sgd.maxMLModelSizeInBytes": "104857600", |
This file contains 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
✗ aws machinelearning describe-evaluations | |
{ | |
"Results": [ | |
{ | |
"EvaluationDataSourceId": "9f8bc29a-54d6-49a5-897c-089fbe7abf01", | |
"Status": "COMPLETED", | |
"Name": "Evaluation: ML model: Data3.txt", | |
"InputDataLocationS3": "s3://jsimon-logs-us/data3.txt", | |
"EvaluationId": "ev-ZYV6BJeN4rQ", | |
"CreatedByIamUser": "MY_ARN", |
OlderNewer