Basic-Plot

Fri 14 November 2025

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


import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [2, 4, 9, 16]
x, y
([1, 2, 3, 4], [2, 4, 9, 16])
plt.plot(x, y, 'ro')
plt.axis([0, 10, 0, 20 …

Category: plot

Read More

Basic-Plot-1

Fri 14 November 2025

title: "Basic Plot With Multiple Axes" author: "Rj" date: 2019-05-06 description: "List Test" type: technical_note draft: false


import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [1, 4, 9, 16]
z = [1, 8, 27, 64]
x, y, z
([1, 2, 3, 4], [1, 4, 9, 16], [1, 8 …

Category: plot

Read More

Basic-Table

Fri 14 November 2025
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base()
/tmp/ipykernel_4126507/3500228846.py:2: MovedIn20Warning: The ``declarative_base()`` function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 2.0) (Background on SQLAlchemy 2 …

Category: sqlalchemy

Read More

Basic-Vector

Fri 14 November 2025

title: "Basic Vector" author: "Raja CSP Raman" date: 2019-05-02 description: "-" type: technical_note draft: false


from gensim import corpora, models, similarities
corpus = [
    [(0, 1.0), (1, 1.0), (2, 1.0)],
    [(2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0), (8, 1.0)],
    [(1, 1 …

Category: gensim-samples

Read More

Bi-Grams

Fri 14 November 2025

title: "Bigrams" author: "Rj" date: 2019-04-29 description: "-" type: technical_note draft: false


import nltk.collocations
import nltk.corpus
import collections
bgm    = nltk.collocations.BigramAssocMeasures()
finder = nltk.collocations.BigramCollocationFinder.from_words(nltk.corpus.brown.words())
scored = finder.score_ngrams( bgm.likelihood_ratio  )
# Group bigrams by first word in bigram.                                        
prefix_keys = collections.defaultdict(list)
for key …

Category: textprocessing

Read More

Bigrams

Fri 14 November 2025
import nltk.collocations
import nltk.corpus
import collections
# import nltk
# nltk.download('brown')
bgm    = nltk.collocations.BigramAssocMeasures()
finder = nltk.collocations.BigramCollocationFinder.from_words(nltk.corpus.brown.words())
scored = finder.score_ngrams( bgm.likelihood_ratio  )
# Group bigrams by first word in bigram.                                        
prefix_keys = collections.defaultdict(list)
for key, scores in scored:
   prefix_keys[key[0 …

Category: textprocessing

Read More

Binary Search

Fri 14 November 2025

title: "Binary Search" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


def binary_search(lys, val):  
    first = 0
    last = len(lys)-1
    index = -1
    while (first <= last) and (index == -1):
        mid = (first+last)//2
        if lys[mid] == val:
            index = mid
        else:
            if val<lys[mid]:
                last = mid -1 …

Category: basics

Read More

Bind-Tools

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")


tools = [
    {
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather in a given location",
            "parameters …

Category: langchain

Read More

Binding-Stop-Sequence

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/binding/
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import …

Category: langchain

Read More

Bogdanov-Map

Fri 14 November 2025

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()

Category: bokeh

Read More
Page 88 of 146

« Prev Next »