Skip to content

Instantly share code, notes, and snippets.

View lucifermorningstar1305's full-sized avatar
👨‍💻
Always Coding

Adityam Ghosh lucifermorningstar1305

👨‍💻
Always Coding
View GitHub Profile
@lucifermorningstar1305
lucifermorningstar1305 / build_vocab.jl
Created July 29, 2022 12:31
Build up the vocabulary
update_lexicon!(crps)
@lucifermorningstar1305
lucifermorningstar1305 / gen_corpus.jl
Created July 29, 2022 12:27
Generate corpus of a text
crps = Corpus(df[:, :Message2])
@lucifermorningstar1305
lucifermorningstar1305 / text_preprocess.jl
Created July 29, 2022 12:09
Simple preprocessing of text in Julia
remove_case!.(df[:, :Message2])
prepare!.(df[:, :Message2], strip_html_tags| strip_punctuation| strip_numbers)
stem!.(df[:, :Message2])
@lucifermorningstar1305
lucifermorningstar1305 / transform_data.jl
Created July 29, 2022 12:00
To transform a particular column of a julia dataframe
df = @chain df begin
DataFrames.transform(:Message => ByRow(x -> StringDocument(x)) => :Message2)
end
@lucifermorningstar1305
lucifermorningstar1305 / read_data.jl
Created July 29, 2022 08:13
Read a CSV file in Julia
df = CSV.read("spam_dataset.csv", DataFrames.DataFrame)
first(df, 10) |> pretty
@lucifermorningstar1305
lucifermorningstar1305 / pkg_import.jl
Created July 29, 2022 07:58
Import packages in Julia
using DataFrames
using CSV
using Gadfly
using TextAnalysis
using MLJ
using Chain
using Pipe
using StableRNGs
@lucifermorningstar1305
lucifermorningstar1305 / add_packages.jl
Created July 29, 2022 07:54
Adding packages to your Julia REPL
> ]
> activate .
> add IJulia BenchmarkTools Plots DataFrames CSV MLJ MLJModels TextAnalysis PyCall Chain Pipe Compose Gadfly Query Statistics StatsBase StableRNGs PrettyPrinting
import numpy as np
from sklearn import preprocessing
features = np.array([[-500, 5],
[2, 10],
[4, 100],
[9, 10]])
# Create the Standard Scaler
standard_scaler = preprocessing.StandardScaler()
# Apply the Standard Rescaling on our feature maps
scaled_feature = standard_scaler.fit_transform(features)
import numpy as np
from sklearn import preprocessing
features = np.array([[-500, 5],
[2, 10],
[4, 100],
[9, 10]])
# Create the MinMax Scaler
minmax_scaler = preprocessing.MinMaxScaler(feature_range=(0,1))
# Apply the MinMax Rescaling on our feature maps
scaled_feature = minmax_scaler.fit_transform(features)
Filter Use
Mean Filter Reduce Gaussian Noise smooth the image after upsampling.
Median Filter Reduce salt and pepper noise.
Sobel Filter Detect edges in an image.
Gaussian Filter Reduce noise in an image.
Canny Filter Detect edges in an image.
Weiner Filter Reduce additive noise and blurring.