0% found this document useful (0 votes)
20 views3 pages

Pulsar Classification SVM Assignment

The document outlines the programming assignment for IIT Kharagpur's AI4ICPS I Hub Foundation, focusing on the classification of pulsar candidates using machine learning techniques. Students are instructed to implement a Support Vector Machine (SVM) function while adhering to specific coding guidelines and utilizing a provided dataset. The assignment emphasizes the importance of proper data handling, including normalization and training/testing splits, and requires the evaluation of model accuracy across various hyperparameter values.

Uploaded by

harsha.p1720
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Pulsar Classification SVM Assignment

The document outlines the programming assignment for IIT Kharagpur's AI4ICPS I Hub Foundation, focusing on the classification of pulsar candidates using machine learning techniques. Students are instructed to implement a Support Vector Machine (SVM) function while adhering to specific coding guidelines and utilizing a provided dataset. The assignment emphasizes the importance of proper data handling, including normalization and training/testing splits, and requires the evaluation of model accuracy across various hyperparameter values.

Uploaded by

harsha.p1720
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

IIT KHARAGPUR AI4ICPS I HUB FOUNDATION

Hands-on Approach to AI, Cohort-3, February – May 2025

Programming Assignment 2
Due date: Sunday 30th March 2025, EOD – IST.

Important Instructions about Programming Assignments

1. Programming assignments will be evaluated automatically. Do not change the skeleton code
provided to you.
2. Write your code only in the designated places in the skeleton code and process the input data
provided to you in the designated variables. Do not alter the input output structure in the skeleton
code.
3. Do not import any additional libraries. Do not use any additional files for the processing other than
those mentioned in the skeleton code from a.(i) to a.(iv).

Failure to comply with these instructions may lead to you getting zero marks for the assignment, even
if the solution is largely correct.

Question:

Objective: Pulsars are a rare type of neutron star that produces radio emissions detectable here on Earth.
They are of considerable scientific interest as probes of space-time, the interstellar medium, and states of
matter. Each pulsar produces a slightly different emission pattern, which varies slightly with each rotation.
Thus, a potential signal detection known as a 'candidate', is averaged over many rotations of the pulsar, as
determined by the length of an observation. In the absence of additional information, each candidate could
potentially describe a real pulsar. However, in practice, almost all detection is caused by radio frequency
interference (RFI) and noise, making legitimate signals hard to find. Machine learning tools are now being
used to automatically label Pulsar candidates to facilitate rapid analysis. Classification systems in particular
are being widely adopted, which treat the candidate data sets as binary classification problems. Here, the
legitimate pulsar examples are a minority positive class, and spurious examples are the majority negative
class.

i. Randomly pick 80% of the data as a training set and the rest as a test set.
ii. Normalize each feature of the dataset to have a zero mean and unit variance. Note that while
normalizing the features, their mean and variance should be computed over the train split only.
Once the mean and variance are computed using only the train split, you normalize the test split
using the mean and variance computed over the train split.
iii. Note that training requires solving the dual optimization problem. To solve the dual optimization
problem, you must use the python package: [Link]

Write a SVM function that takes a new datapoint as input and predicts the class. In SVM, the
hyperparameter C regulates the regularization strength, affecting the balance between a smooth decision
boundary and the accurate classification of training points. Now, for a given set of hyperparameter values
C = [0.1, 1, 10, 100, 1000], what will be their corresponding accuracies, provided we are
using the linear kernel?

Instructions:

1. Do not import any more libraries or modify any functions given in the skeleton code.
2. Input for evaluating the test cases; do not change the hyperparameter C value.
3. The output will be in decimal points.
4. You must use random_state=42 during the train test split.

Dataset: The dataset contains samples of pulsar candidates collected during the High Time Resolution
Universe Survey (South). It has around 17898 instances with 8 continuous attributes.

The target attribute is “Class” which can be legitimate (1) or spurious (0). Please note that the dataset may
contain missing values. To handle these missing values, you should use appropriate techniques.

Data Filename: pulsar_star_dataset.csv

Dataset description: The first four attributes are simple statistics obtained from the integrated pulse profile
(folded profile). This is an array of continuous variables that describe a longitude-resolved version of the
signal that has been averaged in both time and frequency. The remaining four variables are similarly
obtained from the DM-SNR curve. These are summarized below:

1. Mean of the integrated profile.

2. Standard deviation of the integrated profile.

3. Excess kurtosis of the integrated profile.

4. Skewness of the integrated profile.

5. Mean of the DM-SNR curve.

6. Standard deviation of the DM-SNR curve.

7. Excess kurtosis of the DM-SNR curve.

8. Skewness of the DM-SNR curve.

9. Class.

Here, DM-SNR stands for two things: Dispersion Measure (DM) and Signal-to-Noise Ratio (SNR). DM,
as the name suggests, measures the dispersion or spread of pulsar's signals during their journey from pulsar
to earth. SNR, on the other hand, measures the strength of a pulsar's signal relative to background noise.
DM is calculated from the time delay of each signal when it arrives on earth, while SNR is calculated at
the peak intensity of each signal.

Sample Test Cases:

"input": "0.9",
"output": "0.97"

"input": "9",
"output": "0.975"

"input": "90",
"output": "0.975"

"input": "900",
"output": "0.98"
"input": "9000",
"output": "0.98"

Common questions

Powered by AI

In SVM, the hyperparameter C regulates the trade-off between creating a smooth decision boundary and correctly classifying training points. A smaller C values allows for a smoother decision boundary but may misclassify more training points, while a larger C penalizes misclassifications and allows for a more complex model. This influences reported accuracies as a balance must be struck between overfitting (high C) and underfitting (low C). The model's performance improves as C is adjusted optimally considering the bias-variance trade-off unique to the given data set .

Adjusting the hyperparameter C in an SVM with a linear kernel impacts the model's balance between bias and variance. A low C value makes the algorithm lenient to misclassification, potentially underfitting the data, while a high C enforces stricter classifications, which can lead to overfitting. When applied to pulsar candidate classification, we expect different accuracy outcomes: a too small or large C might not perform optimally, whilst an intermediate C value might strike a better accuracy balance .

The cvxopt.solvers plays a crucial role in solving the dual optimization problem involved in training the SVM. This optimization approach helps determine the support vectors that define the decision boundary. Solving the dual problem is essential because it enables the efficient handling of high-dimensional data typically presented in classification tasks, simplifying constraints associated with primal problem formulations. This step is crucial for ensuring that the SVM efficiently learns the decision boundaries with respect to the feature space, which directly affects classification performance .

In feature engineering with continuous attributes such as those in the pulsar dataset, it's pivotal to consider normalization or standardization to ensure feature scales do not bias model training. Further, attention should be given to deriving new insightful features or reducing dimensionality to enhance model efficiency and accuracy. Handles like correlation analysis and feature selection techniques should be applied to identify and retain the most valuable attributes that influence the model's predictive power while reducing noise .

Detecting legitimate pulsar signals poses significant challenges due to the prevalence of radio frequency interference (RFI) and noise, which often overshadow legitimate signals. This makes the task of distinguishing between genuine pulsar signals and noise difficult, as presented in the binary classification system where legitimate pulsar examples are the minority positive class and spurious examples are the majority negative class . These challenges impact the classification system by necessitating accurate tools to avoid false positives and ensure that genuine signals are not missed, enhancing the importance of precise model selection and parameter tuning .

Dispersion Measure (DM) is a critical factor measuring the spread of pulsar signals as they travel to Earth, affecting time delay characteristics of the signal, while Signal-to-Noise Ratio (SNR) measures the signal's strength compared to background noise. Together, DM's time delay characteristics and SNR's peak intensity of the signal provide a comprehensive view of a signal's distinct features, aiding in the classification process by enabling discrimination between legitimate pulsar signals and noise . These features are therefore significant in the identification process as they both represent physical characteristics of pulsar signals .

The use of random_state=42 during the train-test split ensures that the dataset splitting process is reproducible, meaning the same data is selected each time for training and testing, thus eliminating variability introduced by different train-test data distributions in multiple runs . This consistency is crucial for reliable evaluation and comparison of model performance .

The dataset normalization process involves transforming each feature to have a zero mean and unit variance. This is done by computing the mean and variance over the training split and then applying these statistics to both the train and test splits . Computing the mean and variance only over the training data is crucial to prevent information leakage from the test data into the training process, ensuring that the model evaluates real-world performance accurately .

For handling missing values in the pulsar candidate dataset, it is important to employ techniques such as mean imputation or using machine learning algorithms that can naturally handle missing values to ensure the data's consistency and integrity during model training and evaluation . These techniques are necessary to avoid biases that missing data could introduce into the model, which could lead to inaccurate results .

Integrating features such as kurtosis and skewness from different profiles enhances pulsar candidate classification by capturing complex statistical characteristics that describe pulsar signals more comprehensively. Kurtosis measures the peakedness of the distribution, and skewness reflects the symmetry, both of which provide nuanced insights into signal qualities that single-variable measurements might miss. Combined, these features offer a richer dataset that better informs the model, leading to higher accuracy and decreased false positive rates .

You might also like