Locals 1
title: "Locals of Function"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
def myFunc():
print("hello")
Score: 5
Read More
Location-Bts
from gliner import GLiNER
# https://genius.com/Genius-english-translations-bts-on-english-translation-lyrics
# Initialize GLiNER with a pre-trained model
model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1") # Adjust to a location-specific model if needed
Fetching 5 files: 0%| | 0/5 [00:00<?, ?it/s]
/home/rajaraman/miniconda3/envs/ml312/lib/python3.12/site-packages/transformers/convert_slow_tokenizer.py …
Read More
Location-Sample
from gliner import GLiNER
# Initialize GLiNER with a pre-trained model
model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1") # Adjust to a location-specific model if needed
Fetching 5 files: 0%| | 0/5 [00:00<?, ?it/s]
/home/rajaraman/miniconda3/envs/ml312/lib/python3.12/site-packages/transformers/convert_slow_tokenizer.py:562: UserWarning: The sentencepiece …
Read More
Logging 1
title: "Logging"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
import logging
logger = logging.getLogger()
#logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
logger.setLevel(logging.DEBUG)
logging.debug("test")
def do_sample():
for x in range(10):
logging.info('one …
Read More
Logging 2
title: "Logging 2"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
import logging
logger = logging.getLogger()
#fhandler = logging.FileHandler(filename='mylog.log', mode='a')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
#fhandler.setFormatter(formatter)
logger.addHandler(fhandler)
logger.setLevel(logging.DEBUG)
Read More
Logistic-Map-1
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
from bokeh.models import ColumnDataSource
# Set Bokeh output to notebook
output_notebook()
Read More
Logistic-Regression
title: "Logistic Regression"
author: "Rj"
date: 2019-04-21
description: "-"
type: technical_note
draft: false
from sklearn.linear_model import LogisticRegression
import multiprocessing
import pandas as pd
from gensim.models import Doc2Vec
from gensim.models.doc2vec import LabeledSentence
import multiprocessing
from sklearn import utils
from tqdm import tqdm
tqdm.pandas(desc="progress-bar")
Read More
Logistic Regression Breast Cancer
title: "Logistic Regression Breast Cancer"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
import numpy as np
import pandas as pd
from sklearn.datasets import load_breast_cancer
import statsmodels.api as sm
import scipy.stats as st
from statsmodels.tools import add_constant as add_constant
df = load_breast_cancer()
df_cancer = pd.DataFrame(np …
Read More
Long2Ip
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]'
import ipaddress
def long_to_ip(ip_long):
# Convert long integer to IPv4 string
return str(ipaddress.IPv4Address(ip_long))
# Example usage
ip_long = 3232235777
ip …
Read More
Loop-Dictionary
title: "Loop Dictionary"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
d = {'person': 2, 'cat': 4, 'spider': 8}
for animal in d:
legs = d[animal]
print ('A %s has %d legs' % (animal, legs))
A person has 2 legs
A cat has 4 legs
A spider has 8 legs
Score …
Read More