Statistics Basic Notes

🥥 Table of Content




🥑 Get Started!

I. Probability

01 - Conditional Probability & Joint Probaility

$P(x|y) = \dfrac{P(x, y)}{P(y)}$

\(P(x, y) = P(x|y)P(y)\)

If two variables are independent in a joint distribution, we write: $X \perp\!\!\!\perp Y$.

In terms of probability:

$P(X, Y) = P(X)P(Y)$
It also implies that:
$P(X) = P(X|Y) \quad and \quad P(Y) = P(Y|X)$

II. Calculus

Hessian Matrix | Baidu Baike

import sympy as sp

# Define the variables
x, y = sp.symbols('x y')

# Define the function
f = x**2 + 3*y**2

# Compute the Hessian
hessian = sp.hessian(f, [x, y]).tolist()
print(hessian)

🥥 Table of Content




🥑 Get Started!

Statistics

Types of theory

Types of interview questions


Probability


Hypothesis testing

Mastering Hypothesis Testing for Data Science Interviews: Binomial, Z-test, and T-test - Emma Ding | Youtube

  • Terminologies

    • Power
    • p-value
    • Confidence interval
    • Type I error
    • Type II error
  • Parametric tests

    • Z-test
    • T-test
  • Non-parametric tests

    • Chi-squared test


Regression

  • Linear regression
  • Multiple regression

Conceptual Questions

What's the distribution of avg. time spent pe user?

Explain p-value &C.I. to a non-technical audience.

What are the assumptions of linear regression?

Steps to answer

  1. Start with context (When or Where the terminology use)
  2. Provide definition of the concept
  3. Explain the changes(What do the changes in values mean? What does it mean when the concept has larger or smaller value?)
  4. Application(Why is it important for data science)

Calculation Questions

Probability basics
We have a total of 100 coins, which includes 99 fair coins and 1 biased coin that has a probability of getting heads 100%.

If you choose a random coin and flip it 10 times and all 10 times are heads, what's the probability that the coin is the biased coin?

Probability Distribution
What's the probability of getting two heads among 10 tosses of a fair coin?

Hypothesis Testing
Given two groups of users:

  • Compare the click through rates
  • Draw conclusions: are the two click through rates the same?

Coding Questions

HackerRank





Python


01 - Python kick off

02 - List I

(1) List Comprehension

Description
Build a function LstComp which takes two integers (i and j) as inputs and returns a list of numbers from i to j.

Examples
LstComp(1, 5) returns [1, 2, 3, 4, 5]

def LstComp(i, j):
    # Using list comprehension to create a list of numbers from i to j
    return [num for num in range(i, j + 1)]

# Testing the function with the provided example
LstComp(1, 5)

(2) OddNums

Description
Build a function OddNums which takes two integers (i and j) as inputs and returns a list of ODD numbers between i and j inclusively.

Examples
OddNums(1, 5) returns [1, 3, 5]
OddNums(2, 6) returns [3, 5]
OddNums(1, 2) returns [1]

def OddNums(i, j):
    # Using list comprehension to create a list of odd numbers between i and j inclusively
    return [num for num in range(i, j + 1) if num % 2 != 0]

# Testing the function with the provided examples
test_results = {
    "Example 1": OddNums(1, 5),
    "Example 2": OddNums(2, 6),
    "Example 3": OddNums(1, 2)
}

test_results

03 - List II

04 - String

05 - Dictionary

posted @ 2024-02-19 02:09  ForHHeart  阅读(2)  评论(0编辑  收藏  举报