Data Mining 1

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/96

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

97 Terms

1
New cards

Tabular Data

Data that’s found in a “table” format.

2
New cards
<p>This is the:</p>

This is the:

Data Science Lifecycle

3
New cards

Tabular Row

A single observation with a group of features.

4
New cards

Tabular Column

A single feature of a group of observations.

5
New cards

pandas

A python library used to manipulate tabular data.
Similar to R.

6
New cards

Dataframe

A table defined by pandas.

7
New cards

Series

A single column of a table as defined by pandas.
Contains an object that holds an index and a value.

8
New cards

Given a series s, s\text{[“a”]} returns:

The value in s associated with index \text{a}.

9
New cards

Given a series s, s\text{[[“a”,”c”]]} returns:

A series that contains the rows in s that are associated with indices \text{a} and \text{c}.

10
New cards

Given a series s, s>0 returns:

A series that contains every index in s and a bool telling whether or not the value is >0.

11
New cards

Given a series s, s[s>0] returns:

A series that contains every row in s whose value is >0.

12
New cards

Dataframe Index

Defines where a particular row will appear in a dataframe.
Does not have to be numeric or unique.

13
New cards

Given a dataframe df, df.index wil return:

Returns every row from df associated with the index.

14
New cards

Given a dataframe df, df.columns returns:

The name of every column in df.

15
New cards

Given a dataframe df, df.shape returns:

The width and height of df.

16
New cards

Given a dataframe df, df.head(n) returns:

The first n rows from df.

17
New cards

Given a dataframe df, df.tail(n) returns:

The last n rows from df.

18
New cards

Given a dataframe df, df.loc[rows, cols] returns:

All rows specified in rows with only the columns specified in cols from df.

19
New cards

The difference between iloc and loc:

iloc uses the position of the column and row, while loc uses the identifier associated with the column and row.

20
New cards

Given a dataframe df, df[0:3] returns:

Every row from df associated with indices 0 to 3 inclusive.

21
New cards

Given a dataframe df, df[cols] returns:

Every row from df with only the columns specified in cols.

22
New cards

Given a dataframe df, df.loc[:9, :] returns:

The first 10 rows from df with every column included.

23
New cards

Given a dataframe df, df[[True,False,True]] returns:

The 1st and 3rd rows from df.

24
New cards

Given a dataframe df, df[(df[“Sex”]==”F”)] returns:

All rows from df where Sex is equal to F.

25
New cards

Given a dataframe df that has no column testCol, df[“testCol”]=testData will:

Add a column called testCol to df with the rows specified in testData.

26
New cards

Given a dataframe df, df[“col”]=df[“col”]-1 will:

Subtract 1 from every row in the column col from df.

27
New cards

Given a dataframe df, df.rename(columns={“oldCol“:newCol}) returns:

A version of df where oldCol is instead called newCol.

28
New cards

Given a dataframe df, df.drop(“oldCol“, axis=”columns”) returns:

A version of df without oldCol.

29
New cards

Given a dataframe df, df.size returns:

The number of individual elements in df.
I.e. Width \times Height.

30
New cards

Given a dataframe df, df.describe() returns:

A general summary of df.

31
New cards

Given a dataframe df, df.sample(n) returns:

A random sample of n rows from df without replacement.
Calling this again will not returns any of the same n rows.

32
New cards

Given a dataframe df, df[“col”].value\_counts() returns:

How many times each value in col occurs.

33
New cards

Given a dataframe df, df[“col”].unique() returns:

The first occurance of every value in col from df.

34
New cards

Given a dataframe df, df[“col”].sort\_values() will:

Sorts the values of col in numeric or alphabetical order.

35
New cards

Given a dataframe df, df.groupby(“Year“) will:

Group the rows in df by the data in Year.

36
New cards

Aggregate Function

A function that looks at more than one row/column at once.

37
New cards

Given a dataframe df, df.groupby(“Year“).agg(sum) returns:

The sum of each unique year in df.

38
New cards

Given a dataframe df, df.groupby(“Year”).size() returns:

The number of rows in df associated with every unique year.

39
New cards

Given a dataframe df, df.groupby(“Year”).count() returns:

Returns the number of values in each column with a non-missing value associated with every unique year.

40
New cards

Given a dataframe df and a command
df.groupby(col).filter(\text{FUNC}), what goes in \text{FUNC}?

A lambda function that returns either True or False.

41
New cards

Given a dataframe df, df.groupby(val) returns an object of type:

\text{DataFrameGroupBy}

42
New cards

Given a dataframe df, df.groupby(val).agg(func) returns an object of type:

DataFrame

43
New cards

Given two dataframes df1 and df2, pd.merge(left=df1, right=df2, left\_on=”col1”, right\_on=”col2”) returns:

A dataframe that merges df1 and df2 based on col1 and col2.

44
New cards

Given a series S, S.map(func) will:

Apply func to each element in S.

45
New cards

Probability

The frequency with which an event occurs in a collection of independent but identical tries.

46
New cards

P(A|B) stands for:

The probability that A happens due to B happening.

47
New cards

P(A|B)=

\frac{P(B|A) \times P(A)}{P(B)}

48
New cards

Census

A complete count or survey of a population.

49
New cards

Population

The complete set of individuals being studied.

50
New cards

Survey

A set of questions or measurments.

51
New cards

Sample

A subset of the population.

52
New cards

Inference / Prediction

The act of drawing conclusions about a population based on a sample.

53
New cards

Sampling Frame

A subset of the population that could possibly be in a sample.

54
New cards

Selection Bias

Systematically excluding particular groups.

55
New cards

Response Bias

Respondants don’t always respond truthfully.

56
New cards

Population Parameter

A number that describes something about the population.

57
New cards

Sample Statistic

An estimate of the number computed on a sample.

58
New cards

Cenertal Limit Theorem

Given a sample is large enough, its distribution will always resemble a normal distribution and will be centered at the population mean.

59
New cards

Sample Space

All possible outcomes for some random event.

60
New cards

Until an experiment occurs a random variable:

Does not hold a value.

61
New cards

Probabilities

The chance that a random variable will take each possible value.

62
New cards

X \sim F(p) means:

The random variable X has a distribution F with a parameter p.

63
New cards

Null Hypothesis

The “default” hypothesis given a scenario.

64
New cards

P-Value

The probability that a given hypothesis could occur.

65
New cards

Standard Deviation (SD) =

\frac{\text{Population SD}}{\sqrt{Sample Size}}

66
New cards

Square Root Law

Increasing the sample size by a factor will decrease the SD by the square root of the factor.

67
New cards

Convergence

When two or more series of values drift towards the same value.

68
New cards

Expectation

The weighted average of the possible values of a random variable.
The weights are the probabilities of the values.

69
New cards

Given X is a random variable and x is a possible value of X, Expectation =

\sum_{\text{all possible x}}{xP(X=x)}

70
New cards

Exploratory Data Analysis (EDA)

The process of iteratively asking and answering more questions about a dataset.

71
New cards

The EDA process:

Question
Investigate
Interpret
Repeat

72
New cards

Model

An idealized representation of a system.

73
New cards

Deterministic Physical Models

Laws that govern how the world works.

74
New cards

Reasons for building models:

To explain complex phenomena.
To make accurate predictions.
To make casual inferences.

75
New cards

Model Evaluation Statistics:

Error
Bias
Variance

76
New cards

Bias

How close a model is to the estimate (on average) to the parameter.

77
New cards

Variance

How spread out the estimate is.

78
New cards

Mean Squared Error (MSE) given \hat \theta =

E((\hat \theta - \theta)²)

79
New cards

Bias given \hat \theta =

E(\hat \theta - \theta)=E(\hat \theta) - \theta

80
New cards

Variance =

\frac{1}{n} \sum^{n}_{i=1}(x_i - \bar x)²

81
New cards

Simple Linear Regression (\hat y) =

\theta_0 + \theta_1 x

82
New cards

The Modeling Process:

Choose a model.
Choose a loss function.
Fit the model.
Evaluate model performance.

83
New cards

Loss Function

Characterizes the cost / error / fit resulting from a particular choice of model and parameters.

84
New cards

Squared Loss / L2 Loss (L(y,\hat y)) =

(y - \hat y)^2

85
New cards

Absolute Loss / L1 Loss (L(y,\hat y)) =

|y - \hat y|

86
New cards

Covariance =

\frac{1}{n} \sum_i (y_i - \bar y)(x_i - \bar x)

87
New cards

Multiple Linear Regression (\hat y) =

\theta_0 + \theta_1 x_1 + … + \theta_p x_p

88
New cards

L2 Vector Norm given an n^{\text{th}} dimensional vector =

\sqrt{ \sum^{n}_{i=1} (x^2_i) }

89
New cards

Span

The set of all possible linear combinations between two columns of a matrix.

90
New cards

Deductive Reasoning

Reasoning based on nature / tradition.

91
New cards

Inductive Reasoning

Reasoning based on the observations made.

92
New cards

\frac{dz}{dx}=

\frac{dz}{\hat{y}} \times \frac{\hat{y}}{dx}

93
New cards

Multiple Linear Regression assumes that…

Every included parameter has no relationship.

94
New cards

Gradient Descent

Finding the lowest value by stepping in either direction based on the slope.

95
New cards

Given gradient descent and a learning rate \alpha, x^{t+1}=

x^t - \alpha \frac{d}{dx}f(x^t)

96
New cards

Gradient Descent stops after…

A fixed number of updates or the change in results is too low.

97
New cards

MSE for Linear Regression (\hat{R}(\theta)) =

\frac{1}{n} \sum ^{n} _{i=1} (y_i - (\theta_0 + \theta_1 x))^2