Posts for: #Theory/Code

Machine Learning

📦 Import Libraries

import numpy as np
import pandas as pd
import sklearn as skl
import matplotlib.pyplot as plt
  • numpy, pandas: Data manipulation

  • sklearn: ML tools like vectorizers and train/test split

  • matplotlib: Visualization (optional)


📚 NLP Preprocessing Setup

import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
  • re: Regex for text cleaning

  • nltk: Tokenization, stopwords, and stemming


🚫 Custom Stopwords

negatives = ['no', 'nor', 'not', "don't", ...]
all_stopwords = [w for w in stopwords.words('english') if w not in negatives]

Retains negative words like “not”, which are important for sentiment.

Read more →

React Notes

Introduction to React

React is a JavaScript library for building user interfaces, particularly single-page applications where you need a fast, interactive UI.

Installation

To create a new React app, use:

npx create-react-app my-app cd my-app npm start

JSX (JavaScript XML)

JSX allows writing HTML elements inside JavaScript and placing them in the DOM without using methods like createElement.

Example:

const element = <h1>Hello, React!</h1>;

React Components

React components are reusable pieces of UI. There are two types:

Read more →

Selenium Notes

Important Libraries

from selenium import webdriver 
from selenium.webdriver.chrome.service import Service 
from selenium.webdriver.support.ui import Select 
from selenium.webdriver.common.by lmport By 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.support.ui import WebDriverWait 
import time 
from selenium.webdriver.common.action_chains import ActionChains 
from selenium.webdriver.chrome.options import Options 
from selenium webdriver.remote.webelement import WebElement
  1. webdriver

imports the webdriver module from the Selenium library, which allows you to automate browser actions like clicking, typing and navigating.

  1. Service

Service is used to manage the lifecycle of the chromedriver.exe process (starting, stopping, and communication).

Read more →