1/43
Parts of a Histogram
Range, number of bins, number of total entries, number of entries in each bin, number outside range
Why are histograms so useful?
Histograms can reduce large quantities of data into a manageable summary.
When can you trust numerical probablities?
-the quantity of interest has been correctly measured
-size of error has been correctly calculated
What is Chi-Square and what is it used for?
-used to compare models, to see which is more likely to produce the observed data
-measures the collective deviation of the data points from the model, and the model that produces the smallest chi-squared value is the most consistent with the data
Degree of freedom (k)
1 data point = 1 degree of freedom
As the number of degrees of freedom gets larger, the chi-square distribution approaches a Gaussian/Normal shape
What are reduced chi-square values and when do you use them?
-used when comparing chi-square values with different degrees of freedom
-is chi square divided by k so x^ 2/k
-if k is large, reduced chi square is ~ 1
What questions can we answer with chi-square?
Given a particular theory, what is the probability that data this different or more different could have occurred?
Are the data inconsistent with the model?
How do you calculate the probability of multiple observations?
multiply the individual probabilities together to get the collective probability of all values
How do we minimize the chi-square value?
find parameters a, b that best minimize the value, (can use partial derivatives)
Things that can go wrong with curve fitting
Using an incorrect model to represent the data
Making a poor choice of starting parameters (too far from correct values; sometimes starting at 0.0 is hard for a program, too)
Sometimes parameters land on unphysical values during the chi-square minimization process (1/0, log(-10), sqrt of a negative, etc)
Fitting too many parameters at once while far from the minimum chi-square value
Choosing a poor set of model parameters (high correlation, large difference in scale)
too many pararmeters for a model meansā¦
means your model can describe anything & is sensitive to fluctuations (John Von Neumann: "with four parameters I can fit an elephant, with five I can make him wiggle his trunk")
curve fitting with scipy: what is the name of the function and what parameters do you enter?
To perform a curve fit on histogram data in SciPy, you need to use the scipy.optimize.curve_fit function and explicitly provide the bin centers as the x data. ⢠The y data will be the histogram's bin heights.
How to check if you have a probability distribution (density=true)?
If you integrate the distribution, the value should be ~1.
If you perform a curve fit on a dataset containing k data points using a model with n_params adjustable parameters, how is the number of degrees of freedom for assessing fit quality (k_fit) correctly calculated?
K_fit = k - n_params
As a general rule of thumb in data analysis, what does a reduced chi-squared value chi_red^2 = chi^2/k of approximately 1.0 signify?
good agreement between the model and its data; when it is ~1, it means that each data point deviates from the model by one standard deviation on average
When performing a curve fit on histogram data in Python using scipy.optimize.curve_fit, what values should be passed as the independent variable (x data) argument?
the bin centers calculated from the bin edges
What do too large and too small chi2 values imply?
Too LARGE reduced chi2 implies poor agreement btwn theory and data. Too SMALL reduced chi2 (<1) implies one could be OVERFITTING the data ā the agreement should still be impacted by the uncertainty on each point.
How can you gauge the quality of your fiit?
By looking at the āfit residuals.ā These are the deviation of your data points from the values predicted by your model.
Fit residuals can be measured in terms of standard deviations.
f_r = (data - fit)/sigma
Pull Distribution
The distribution of the fit residuals is called the āpull distribution.ā
Pull Distribution Properties
If the mean = 0, the modelās shape matches the data well
If the width (sigma) is one, the data points are normally distributed around the modelās predictions, consistent with their uncertainties (sigma)
Cumulative Distribution Function (CDF)
For every probability distribution, thereās an associated āCumulative Distribution Function.ā This is the integral from negative infinity to x of the probability function (PDF).
Properties of the CDF
At any point x, the CDF tells us the probability of observing a random number less than or equal to x. As x approaches infinity, the value of the CDF approaches 1.
Batch computing - what is it and why do we use it?
Non-interactive computation ā prepare a ājobā (program) and submit it to run on a remote computer.
This can be valuable if your jobs are long, require special computing environments, or you need to run many copies of your code in parallel.
Rivanna
Primairly a batch computing system. Afton+Rivanna = 50,000 cores
Node - what is it and what are the two types?
basic building block of a cluster
Two types
head node - computer used for logging on and submitting jobs
computer node - computer that does most of the work
Core
an individual processor on a computer
The main use of the rivanna cluster is in ābatchā mode, what program do we use for this?
A program called SLURM is used to manage jobs:
⢠Priority
⢠Input/output data
⢠Job sections
SLURM
used for submitting jobs to computer nodes from the head node
SLURM script
a SLURM script is a bash script with SLURM directives (#SBATCH) and command-line instructions for running your program
How do you check the status of your jobs? How do you cancel a job?
squeue -u <user id>; scancel <job id #>
SLURM environmental variables
Each job will be provided an environment variable:
SLURM_ARRAY_JOB_ID
And each task will be assigned:
SLURM_ARRAY_TASK_ID
in a slurm script %A represents the job id and %a represents the task ID
When submitting a SLURM job array on Rivanna, which environment variable is automatically assigned to each task to distinguish its specific index in the array?
SLURM_ARRAY_TASK_ID
In the context of Rivanna computing resources, how is 1 Service Unit (SU) defined?
1 core-hour
array syntax for slurm
sbatch --array=1-100 myslurm_array
whatās one way to classify data when you canāt do it by just characteristics?
If we look at the correlations between variables, we can find ways to separate the data based on multi-variable distributions. ie sepal length vs sepal width
Pearsonās correlation coefficient
Pearsonās correlation coefficient provides a numeric FOM for the level of linear correlation
Postive vs Neutral vs Negative Correlation
Positive Correlation: both variables change in the same direction.
Neutral Correlation: No relationship in the change of the variables.
Negative Correlation: variables change in opposite directions.
What crucial component must every recursive function in Python possess to prevent infinite recursion and a runtime error?
a terminating question
Recursive function
Functions that call themselves
Command for creating a pandas dataframe
pd.DataFrame
Empirical Distribution Function
a CDF obtained from the data and not a mathematical model
ECDF(x) = (number of data points <= x)/(total number of data points)
How is an ECDf constructed?
Made form unbinned data; uses raw, measured values
What does the Kolmogorov-Smirnov (KS) test evaluate when comparing a model to a dataset?
The maximum vertical deviation between the empirical cumulative distribution function (ECDF) of the data and the models cumulative distribution function (CDF).
Kolmogorov-Smirnov Statistic D_N
the maximum vertical deviation is called the Kolmogrov-Smirnov statistic