Pca-Simple

Fri 14 November 2025

title: "PCA Simple" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVC
from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
from sklearn.feature_selection import SelectKBest
iris = load_iris()
X, y = iris.data, iris …

Category: sklearn

Read More

Periya-Retriever

Fri 14 November 2025
!python --version
Python 3.12.4
from constants import OPENAI_API_KEY
!pip show langchain-openai | grep "Version:"
Version: 0.2.9
import os
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4o-mini")
# https://python.langchain.com/docs/how_to/passthrough/
from langchain_community.vectorstores import FAISS
from langchain_core.output_parsers import …

Category: langchain

Read More

Periyar-Fact

Fri 14 November 2025
!python --version
Python 3.12.4
from constants import OPENAI_API_KEY
!pip show langchain-openai | grep "Version:"
Version: 0.2.9
import os
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4o-mini")
from operator import itemgetter

from langchain_community.vectorstores import FAISS
from langchain_core.output_parsers import StrOutputParser
from langchain_core …

Category: langchain

Read More

Pertland-Questions

Fri 14 November 2025

6
How to: pass through inputs from one chain step to the next
https://python.langchain.com/docs/how_to/passthrough/

!python --version
Python 3.12.4
from constants import OPENAI_API_KEY
!pip show langchain-openai | grep "Version:"
Version: 0.2.9
import os
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
from langchain_openai import ChatOpenAI …

Category: langchain

Read More

Phone-Number-Search

Fri 14 November 2025

title: "Phone Number Search" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


import re
fh = open("sample_phone_book.txt")

for line in fh:
    if re.search(r"J.*Neu",line):
        print(line.rstrip())

    if re.search(r"a*Neu",line):
        print(line.rstrip())
fh.close()
Allison Neu 555-8396 …

Category: regex

Read More

Pint-1

Fri 14 November 2025
# Created: 20250103
# https://pypi.org/project/Pint/0.24.4/
# !pip install pint
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: ml312-2024; pyv: 3.12.7 | packaged by Anaconda, Inc. | (main, Oct  4 2024, 13:27:36) [GCC 11.2.0]'
print(pyu.ps2("requests pint"))
requests==2.32 …

Category: trends

Read More

Placeholders

Fri 14 November 2025

title: "Add Method" author: "Raja CSP Raman" date: 2019-05-07 description: "-" type: technical_note draft: false


import tensorflow as tf

import os

# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# Initialize global variables

init_op = tf.global_variables_initializer()
session = tf.Session()
session.run(init_op)
a = tf.placeholder(tf.float32 …

Category: tensorflow-work

Read More

Plotine-1

Fri 14 November 2025

title: "Plotline Simple" author: "Rj" date: 2019-05-06 description: "List Test" type: technical_note draft: false


import pandas as pd
import numpy as np

from plotnine import *

%matplotlib inline
df = pd.DataFrame({
    'variable': ['gender', 'gender', 'age', 'age', 'age', 'income', 'income', 'income', 'income'],
    'category': ['Female', 'Male', '1-24', '25-54', '55+', 'Lo', 'Lo-Med', 'Med', 'High …

Category: plot

Read More

Polarity-Score

Fri 14 November 2025

title: "Polarity Score" author: "Rj" date: 2019-04-21 description: "-" type: technical_note draft: false


from nltk.sentiment.vader import SentimentIntensityAnalyzer
def get_polorize_score(sentence):
    sid = SentimentIntensityAnalyzer()

    print(sentence)
    ss = sid.polarity_scores(sentence)

    return ss
print(get_polorize_score('very Good support for work.'))
very Good support for work.
{'neg': 0.0, 'neu': 0.327, 'pos …

Category: textprocessing

Read More

Porter-Stemmer

Fri 14 November 2025

title: "Porter Stemmer" author: "Rj" date: 2019-04-21 description: "-" type: technical_note draft: false


from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()
words =  [
    "radios",
    "colors",
    "mumbled"
]
words
['radios', 'colors', 'mumbled']
result = [stemmer.stem(word) for word in words]
result
['radio', 'color', 'mumbl']


Score: 5

Category: textprocessing

Read More
Page 120 of 146

« Prev Next »