<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sertay Ozer on Medium]]></title>
        <description><![CDATA[Stories by Sertay Ozer on Medium]]></description>
        <link>https://medium.com/@sertayozer?source=rss-8f3c621b2e71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YhYtC5sIZeq4nYMJ.jpg</url>
            <title>Stories by Sertay Ozer on Medium</title>
            <link>https://medium.com/@sertayozer?source=rss-8f3c621b2e71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 20:05:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sertayozer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Giving Patients Their Voice Back: How AI Can Help Restore Acoustic Identity After Total…]]></title>
            <link>https://medium.com/@sertayozer/giving-patients-their-voice-back-how-ai-can-help-restore-acoustic-identity-after-total-b72e2b29e4e5?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/b72e2b29e4e5</guid>
            <category><![CDATA[digital-health]]></category>
            <category><![CDATA[health-technology]]></category>
            <category><![CDATA[voice-ai]]></category>
            <category><![CDATA[generative-ai-healthcare]]></category>
            <category><![CDATA[medical-ai]]></category>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Thu, 14 May 2026 16:23:45 GMT</pubDate>
            <atom:updated>2026-05-14T16:23:45.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m7AQkfrHMohY_UhwFIvmPg.png" /><figcaption>Giving Patients Their Voice Back With AI</figcaption></figure><h3>Giving Patients Their Voice Back: How AI Can Help Restore Acoustic Identity After Total Laryngectomy</h3><h3>Beyond speech restoration, toward restoring who we are</h3><p>When we talk about voice, we usually think about communication.</p><p>But a voice is much more than a tool for speaking.</p><p>It carries identity.<br> It carries emotion.<br> It carries memory.<br> It is the sound by which our family recognizes us, the tone that reflects our personality, and increasingly, the biometric signature that connects us to the digital world.</p><p>For patients who undergo total laryngectomy, the loss of natural voice is one of the most life-changing consequences of treatment. The surgery may save a life, but it also removes the biological ability to produce natural phonation.</p><p>Traditional rehabilitation methods such as electrolarynx devices, esophageal speech, or tracheoesophageal speech can help patients communicate again. However, these solutions often focus mainly on functional speech: making words understandable.</p><p>But what about the patient’s original voice?</p><p>What about sounding like themselves again?</p><p>This question became the foundation of our recently published technical framework in Cureus:</p><p><strong>Restoration of Acoustic Identity via Artificial Intelligence-Driven Neural Voice Conversion for Total Laryngectomy Patients: A Technical Framework for Biometric Security and Social Inclusion</strong></p><p>Full article:<br> <a href="https://www.cureus.com/articles/484972-restoration-of-acoustic-identity-via-artificial-intelligence-driven-neural-voice-conversion-for-total-laryngectomy-patients-a-technical-framework-for-biometric-security-and-social-inclusion#!/">https://www.cureus.com/articles/484972-restoration-of-acoustic-identity-via-artificial-intelligence-driven-neural-voice-conversion-for-total-laryngectomy-patients-a-technical-framework-for-biometric-security-and-social-inclusion#!/</a></p><h3>Why voice is also identity</h3><p>A person’s voice is deeply personal.</p><p>It includes pitch, rhythm, tone, emotional expression, accent, and subtle acoustic patterns that make one person recognizable to another.</p><p>After total laryngectomy, many patients regain the ability to communicate, but the voice they use may sound robotic, monotonic, mechanical, or very different from their preoperative voice.</p><p>This creates a second layer of loss.</p><p>The patient may be able to speak, but may no longer sound like themselves.</p><p>In daily life, this can affect confidence, social interaction, emotional expression, and quality of life. In the digital world, it can also create new barriers. Voice-based authentication is now used in banking, mobile devices, smart home systems, and enterprise security platforms.</p><p>If a patient’s postoperative voice no longer matches their previous biometric voiceprint, they may become excluded from systems that once recognized them.</p><p>So the challenge is not only medical.</p><p>It is social, psychological, and digital.</p><h3>The idea: restoring the patient’s acoustic identity</h3><p>The concept behind AI-driven Neural Voice Conversion is simple but powerful:</p><p>Take the patient’s postoperative speech, such as electrolarynx or esophageal speech, and transform it into a voice that resembles their original preoperative voice.</p><p>The goal is not to create a random artificial voice.</p><p>The goal is to restore the patient’s own acoustic profile.</p><p>To achieve this, the system uses two important sources of information:</p><p>The first is the patient’s current postoperative speech.</p><p>The second is a preoperative digital voice bank, which may include recordings captured before surgery or available historical voice samples.</p><p>The AI model then learns how to preserve the linguistic content of speech while converting the acoustic characteristics toward the patient’s original voice identity.</p><p>In other words:</p><p>The words remain the same.<br> The meaning remains the same.<br> But the voice becomes closer to the person’s own voice.</p><h3>A light technical look at the framework</h3><p>The proposed framework is based on Neural Voice Conversion.</p><p>At a high level, the system tries to separate speech into different layers:</p><p>What is being said.<br> How it is being said.<br> Who is speaking.</p><p>This separation is critical.</p><p>The AI system should not change the sentence. It should not change the message. It should only reconstruct the acoustic features that make the voice sound like the patient.</p><p>The framework includes several AI and speech-processing components:</p><h3>1. Speech feature extraction</h3><p>The system analyzes acoustic features such as fundamental frequency, spectral envelope, and aperiodicity.</p><p>These features help describe the structure of the voice signal and provide the technical foundation for reconstruction.</p><h3>2. Speaker identity representation</h3><p>A speaker encoder maps the patient’s voice identity into a high-dimensional embedding space.</p><p>This allows the system to learn the unique vocal characteristics of the patient, such as timbre, prosody, and speaker-specific acoustic patterns.</p><h3>3. Neural Voice Conversion model</h3><p>The framework uses generative AI methods, including models such as GAN-based voice conversion and Variational Autoencoders.</p><p>These models help transform mechanical or esophageal speech into a more natural and personalized voice output.</p><h3>4. Mel-spectrogram refinement</h3><p>The system refines the generated speech signal to improve audio quality and preserve speaker-specific details.</p><p>This is important not only for naturalness, but also for biometric consistency.</p><h3>5. Real-time communication</h3><p>The long-term vision is not limited to offline voice generation.</p><p>The framework aims to support real-time communication through phone calls, VoIP, WebRTC, mobile systems, and wearable or edge-based devices.</p><p>This is where the idea becomes especially meaningful.</p><p>AI voice restoration should not remain only a research concept. It should become a practical assistive technology that helps patients communicate in real life.</p><h3>Why biometric security matters</h3><p>One of the most important parts of this framework is biometric integrity.</p><p>AI voice technology should not only sound natural.</p><p>It must also be safe.</p><p>If a reconstructed voice is intended to represent a real person, the system must protect that person’s biometric data. Voice recordings, speaker embeddings, and converted outputs should be treated as sensitive medical and biometric information.</p><p>This means privacy, encryption, informed consent, anti-cloning mechanisms, and strong data governance are not optional.</p><p>They are core requirements.</p><p>A restored voice should empower the patient, not create a new risk of identity misuse.</p><h3>From assistive device to biometric prosthesis</h3><p>Traditional speech aids mainly focus on intelligibility.</p><p>Can the patient speak?<br> Can others understand the words?</p><p>These are essential goals, but they may not be enough anymore.</p><p>The next generation of speech rehabilitation should also ask:</p><p>Does the patient sound like themselves?<br> Can they express emotion naturally?<br> Can they regain confidence in social interactions?<br> Can they participate in digital systems that rely on voice identity?<br> Can technology help restore dignity, not only communication?</p><p>This is why AI-driven voice restoration can be understood as more than an assistive device.</p><p>It can be seen as a kind of biometric prosthesis.</p><p>A technology that helps restore part of the patient’s personal, social, and digital identity.</p><h3>The role of vocal banking</h3><p>For this approach to become clinically useful, vocal banking should become part of the pre-surgical workflow.</p><p>When a patient is diagnosed and surgery is planned, high-quality voice recordings could be captured before the operation. These recordings would later serve as the patient’s acoustic baseline.</p><p>Even a limited voice bank may help AI models learn the patient’s unique vocal characteristics.</p><p>This requires collaboration between surgeons, speech-language therapists, AI engineers, cybersecurity experts, healthcare institutions, and patients.</p><p>It is not only a software problem.</p><p>It is an interdisciplinary healthcare technology challenge.</p><h3>Ethical design must come first</h3><p>AI voice restoration has enormous potential, but it also comes with serious responsibilities.</p><p>A patient’s voice is not just data.</p><p>It is identity.</p><p>Any system working with personal voice reconstruction must be designed around consent, privacy, transparency, and patient control.</p><p>Patients should know:</p><p>How their voice data is collected.<br> Where it is stored.<br> How it is used.<br> Who can access it.<br> How it can be deleted.<br> How unauthorized voice cloning is prevented.</p><p>In healthcare AI, innovation is not only about what we can build.</p><p>It is also about what we can protect.</p><h3>A future where survival does not mean losing identity</h3><p>Total laryngectomy is a life-saving procedure.</p><p>But after survival, quality of life becomes the next major challenge.</p><p>AI-driven Neural Voice Conversion offers a new perspective: postoperative rehabilitation should not stop at functional speech.</p><p>It should aim to restore communication, emotional expression, social participation, biometric continuity, and digital inclusion.</p><p>The future of medical AI should not be limited to diagnosis, automation, or prediction.</p><p>It should also help people recover parts of themselves that disease and surgery have taken away.</p><p>Restoring a voice is not only about sound.</p><p>It is about dignity.<br> It is about identity.<br> It is about inclusion.</p><p>And sometimes, giving someone their voice back means helping them feel like themselves again.</p><h3>Full technical article</h3><p>For readers interested in the complete technical framework, model architecture, biometric security perspective, and clinical motivation, the full article is available here:</p><p><strong>Restoration of Acoustic Identity via Artificial Intelligence-Driven Neural Voice Conversion for Total Laryngectomy Patients: A Technical Framework for Biometric Security and Social Inclusion</strong></p><p>Published in Cureus<br> DOI: 10.7759/cureus.107953</p><p><a href="https://www.cureus.com/articles/484972-restoration-of-acoustic-identity-via-artificial-intelligence-driven-neural-voice-conversion-for-total-laryngectomy-patients-a-technical-framework-for-biometric-security-and-social-inclusion#!/">Restoration of Acoustic Identity via Artificial Intelligence-Driven Neural Voice Conversion for Total Laryngectomy Patients: A Technical Framework for Biometric Security and Social Inclusion</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b72e2b29e4e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Production-Ready RAG Chatbot in 15 Minutes with Oracle AI Database 26ai]]></title>
            <link>https://medium.com/@sertayozer/build-a-production-ready-rag-chatbot-in-15-minutes-with-oracle-ai-database-26ai-a586813e2f59?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/a586813e2f59</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Fri, 07 Nov 2025 06:19:21 GMT</pubDate>
            <atom:updated>2025-11-07T06:28:10.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6h_v2R6H3WCvlZFRU4NSlw.png" /></figure><p>No LangChain. No Pinecone. Just SQL + REST.</p><h3>What You’ll Build</h3><p>A <strong>fully autonomous RAG chatbot</strong> that:</p><ul><li>Answers <strong>any question</strong> about your company docs</li><li>Uses <strong>Oracle 26ai Vector Search</strong> (in-DB, zero ETL)</li><li>Grounds answers with <strong>source citations</strong></li><li>Runs on <strong>OCI Free Tier</strong></li><li>Exposed via <strong>REST API (MCP Server)</strong></li><li><strong>Fully multi-turn</strong>, <strong>session-aware</strong>, <strong>PDF auto-chunking</strong> ready</li></ul><p>Open sqlplus. Connect to <strong>Autonomous Database 26ai</strong>. No GPU. No external vector store. No data movement.</p><p><strong>15 minutes later:</strong> A <strong>production-grade RAG pipeline</strong> is live — powered by <strong>in-database HNSW vector search</strong>, <strong>ONNX-embedded chunks</strong>, <strong>OCI-hosted Llama 3 70B</strong>, and <strong>MCP Server REST endpoint</strong> with <strong>session-aware context</strong> and <strong>citation metadata</strong>.</p><p><strong>Stack:</strong> Oracle 26ai + OCI GenAI (Llama 3) + MCP Server + curl</p><p><strong>Step 1: Spin Up 26ai (2 mins)</strong></p><pre># OCI Console → Autonomous Database → Create<br>Name: ragdb26<br>Workload: Transaction Processing<br>Deployment: Serverless<br>Always Free: YES<br>Admin Password: Oracle26ai#2025</pre><p><strong>Step 2: Load Docs &amp; Embed (SQL — 3 mins)</strong></p><pre>-- 1. Create vector table with metadata<br>CREATE TABLE company_docs (<br>  id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,<br>  chunk_text CLOB,<br>  source_url VARCHAR2(500),<br>  page_number NUMBER,<br>  chunk_index NUMBER,<br>  embedding VECTOR(384, FLOAT32),<br>  session_id VARCHAR2(50) DEFAULT &#39;global&#39; -- for multi-turn<br>);<br><br>-- 2. Create HNSW index (sub-second search)<br>CREATE VECTOR INDEX docs_hnsw_idx ON company_docs(embedding)<br>ORGANIZATION INDEX HNSW<br>PARAMETERS(&#39;quality high&#39;, &#39;m 16&#39;, &#39;ef_construction 200&#39;);</pre><p>Insert Sample Docs (or load your PDFs via DBMS_CLOUD)</p><pre>INSERT INTO company_docs (chunk_text, source_url, page_number, chunk_index, embedding) VALUES<br>(&#39;Oracle Database 26ai introduces native AI Vector Search and in-database LLM agents. It supports ONNX models and Apache Iceberg.&#39;, <br> &#39;https://oracle.com/26ai-whitepaper.pdf&#39;, 1, 1, <br> VECTOR_EMBEDDING(&#39;ALL_MINILM_L12_V2&#39;, &#39;Oracle Database 26ai introduces native AI Vector Search and in-database LLM agents. It supports ONNX models and Apache Iceberg.&#39;));<br><br>INSERT INTO company_docs (chunk_text, source_url, page_number, chunk_index, embedding) VALUES<br>(&#39;RAG improves LLM accuracy by grounding responses in real data. 26ai does this natively with zero data movement.&#39;, <br> &#39;https://oracle.com/rag-guide.pdf&#39;, 3, 2, <br> VECTOR_EMBEDDING(&#39;ALL_MINILM_L12_V2&#39;, &#39;RAG improves LLM accuracy by grounding responses in real data. 26ai does this natively with zero data movement.&#39;));<br><br>COMMIT;</pre><p>Pro Tip: Auto-chunk PDFs with PL/SQL:</p><pre>FOR rec IN (SELECT chunk FROM pdf_chunks) LOOP<br>  INSERT INTO company_docs (...) VALUES (rec.chunk, ..., VECTOR_EMBEDDING(...));<br>END LOOP;</pre><p><strong>Step 3: Create AI Profile with Llama 3 (OCI GenAI — 2 mins)</strong></p><pre>BEGIN<br>  DBMS_CLOUD_AI.CREATE_PROFILE(<br>    profile_name =&gt; &#39;oci_llama3_rag&#39;,<br>    attributes =&gt; &#39;{<br>      &quot;provider&quot;: &quot;oci&quot;,<br>      &quot;compartment_id&quot;: &quot;ocid1.compartment.oc1..aaaa...&quot;,<br>      &quot;model&quot;: &quot;meta.llama-3-70b-instruct&quot;,<br>      &quot;temperature&quot;: 0.1,<br>      &quot;max_tokens&quot;: 512,<br>      &quot;system_prompt&quot;: &quot;You are an expert Oracle 26ai assistant. Be concise. Cite sources with [1], [2].&quot;<br>    }&#39;<br>  );<br>END;<br>/</pre><p><strong>Step 4: Build RAG Agent with Select AI Agent (1 min)</strong></p><pre>BEGIN<br>  DBMS_CLOUD_AI.CREATE_AGENT(<br>    agent_name =&gt; &#39;rag_chatbot&#39;,<br>    profile =&gt; &#39;oci_llama3_rag&#39;,<br>    task =&gt; q&#39;[<br>      You are a helpful assistant for Oracle 26ai.<br>      Use the table &quot;company_docs&quot; for context.<br>      Always cite sources using [1], [2] format with page numbers.<br>      If unsure, say &quot;I don&#39;t have that info.&quot;<br>      Support multi-turn: reference session_id.<br>    ]&#39;,<br>    retrieval =&gt; &#39;{<br>      &quot;table&quot;: &quot;company_docs&quot;,<br>      &quot;vector_column&quot;: &quot;embedding&quot;,<br>      &quot;text_column&quot;: &quot;chunk_text&quot;,<br>      &quot;top_k&quot;: 3,<br>      &quot;metadata_columns&quot;: [&quot;source_url&quot;, &quot;page_number&quot;, &quot;chunk_index&quot;],<br>      &quot;filter&quot;: &quot;session_id = :session_id OR session_id = &#39;&#39;global&#39;&#39;&quot;<br>    }&#39;<br>  );<br>  <br>  DBMS_CLOUD_AI.ENABLE_AGENT(&#39;rag_chatbot&#39;);<br>END;<br>/</pre><p><strong>Step 5: Expose as REST API via MCP Server (2 mins)</strong></p><pre>BEGIN<br>  DBMS_CLOUD_ADMIN.ENABLE_FEATURE(&#39;MCP&#39;);<br>END;</pre><p>Start MCP Server (via OCI Compute or locally)</p><pre># Session 1: First question<br>curl -X POST https://your-mcp-endpoint.oraclecloud.com/agent/rag_chatbot \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -H &quot;X-Session-ID: sess_123&quot; \<br>  -d &#39;{<br>    &quot;question&quot;: &quot;Oracle 26ai&#39;&#39;de RAG nasıl çalışır?&quot;<br>  }&#39;</pre><p><strong>Step 6: Ask Your Chatbot (curl — 30 secs)</strong></p><pre># Session 1: First question<br>curl -X POST https://your-mcp-endpoint.oraclecloud.com/agent/rag_chatbot \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -H &quot;X-Session-ID: sess_123&quot; \<br>  -d &#39;{<br>    &quot;question&quot;: &quot;Oracle 26ai&#39;&#39;de RAG nasıl çalışır?&quot;<br>  }&#39;</pre><p>Response</p><pre>{<br>  &quot;answer&quot;: &quot;Oracle 26ai, RAG&#39;ı veritabanı içinde yerel olarak çalıştırır. Vector Search ile ilgili doküman parçacıklarını bulur (HNSW index), Llama 3 ile birleştirir. Veri hareketi yok, latency &lt;500ms. [1, p.1][2, p.3]&quot;,<br>  &quot;sources&quot;: [<br>    {&quot;id&quot;: 1, &quot;url&quot;: &quot;https://oracle.com/26ai-whitepaper.pdf&quot;, &quot;page&quot;: 1},<br>    {&quot;id&quot;: 2, &quot;url&quot;: &quot;https://oracle.com/rag-guide.pdf&quot;, &quot;page&quot;: 3}<br>  ],<br>  &quot;session_id&quot;: &quot;sess_123&quot;,<br>  &quot;latency_ms&quot;: 412<br>}</pre><pre># Session 2: Follow-up (multi-turn)<br>curl -X POST https://your-mcp-endpoint.oraclecloud.com/agent/rag_chatbot \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -H &quot;X-Session-ID: sess_123&quot; \<br>  -d &#39;{<br>    &quot;question&quot;: &quot;Hangi index tipi kullanılıyor?&quot;<br>  }&#39;</pre><pre>{<br>  &quot;answer&quot;: &quot;HNSW (Hierarchical Navigable Small World) index kullanılıyor. ef_construction=200 ile yüksek doğruluk ve &lt;100ms sorgu süresi sağlıyor. [1, p.1]&quot;,<br>  &quot;sources&quot;: [<br>    {&quot;id&quot;: 1, &quot;url&quot;: &quot;https://oracle.com/26ai-whitepaper.pdf&quot;, &quot;page&quot;: 1}<br>  ],<br>  &quot;session_id&quot;: &quot;sess_123&quot;,<br>  &quot;latency_ms&quot;: 298<br>}</pre><p><strong>Resources</strong></p><ul><li><a href="https://docs.oracle.com/en/database/oracle/oracle-database/26/vecse">Oracle 26ai Docs — Vector Search</a></li><li><a href="https://github.com/oracle/mcp-server">MCP Server GitHub</a></li><li><a href="https://cloud.oracle.com/genai">OCI GenAI Models</a></li><li><a href="https://oracle.com/cloud/free">Free Tier Limits</a></li></ul><p>Connect: linkedin.com/in/sertayozer</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a586813e2f59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of SQL is Semantic: Why Oracle 26ai Changes Everything]]></title>
            <link>https://medium.com/@sertayozer/the-future-of-sql-is-semantic-why-oracle-26ai-changes-everything-c91b6c017f88?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/c91b6c017f88</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 10:04:12 GMT</pubDate>
            <atom:updated>2025-10-21T11:11:02.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kK1rWeuN62H5z_RltOjGjg.png" /></figure><p>Oracle 26ai marks a fundamental inflection point in the evolution of enterprise data management — where SQL begins to understand meaning, not just structure.</p><ol><li><strong>The Evolution of Data Intelligence</strong></li></ol><p>For decades, SQL has served as the backbone of enterprise information systems.<br> Its strength lies in precision, structure, and relational integrity. However, as organizations increasingly rely on unstructured data — text, documents, and contextual signals — the traditional relational paradigm has shown its limitations.</p><p><strong>Oracle Database 26ai</strong> represents the next stage of this evolution.<br> It integrates artificial intelligence directly into the database kernel, transforming SQL from a purely declarative query language into a <strong>semantic reasoning interface</strong>. This shift enables enterprises to interact with their data using natural language, similarity search, and contextual understanding — all within a single, secure, and high-performance environment.</p><p><strong>2. Introducing Oracle 26ai: The AI-Native Database</strong></p><p>Oracle 26ai is not merely an incremental release.<br> It is a comprehensive re-architecture of the database engine to support <strong>AI-native capabilities</strong>, including:</p><ul><li><strong>AI Vector Search</strong> for semantic similarity and contextual retrieval</li><li><strong>Select AI</strong> for natural-language-to-SQL translation</li><li><strong>JSON Relational Duality</strong> for unified structured and semi-structured data modeling</li><li><strong>Model Context Protocol (MCP)</strong> for secure integration with external large language models (LLMs)</li><li><strong>RAG (Retrieval-Augmented Generation)</strong> pipelines natively embedded within the database</li></ul><p>By converging transactional, analytical, and AI workloads, Oracle 26ai eliminates the need for separate vector databases or external AI services.</p><p><strong>3. From Syntax to Semantics: A New Era of SQL</strong></p><p>Traditional SQL focuses on structure:</p><pre>SELECT department, SUM(revenue)<br>FROM sales<br>WHERE year = 2025<br>GROUP BY department;</pre><p>In Oracle 26ai, queries can express <em>intent</em> instead of syntax:</p><pre>SELECT AI<br>  PROMPT &#39;Show the total revenue per department for fiscal year 2025&#39;;</pre><p>Through <strong>Select AI</strong>, the database communicates with a configured LLM (such as OCI Generative AI, OpenAI, or Anthropic), translates the prompt into executable SQL, and securely returns the result set.</p><p>The database becomes not only a data repository but an intelligent interface — capable of interpreting natural language in business context while maintaining governance and auditability.</p><p><strong>4. Semantic Context through Vector Search</strong></p><p>The cornerstone of Oracle’s AI integration is the <strong>VECTOR</strong> data type.<br> It allows developers to store embeddings — numeric representations of semantic meaning — alongside relational data.</p><pre>CREATE TABLE knowledge_base (<br>  doc_id     NUMBER PRIMARY KEY,<br>  content    CLOB,<br>  embedding  VECTOR<br>);<br><br>CREATE VECTOR INDEX kb_hnsw<br>ON knowledge_base (embedding)<br>ORGANIZATION INMEMORY NEIGHBOR GRAPH<br>DISTANCE COSINE;<br></pre><p>This enables <strong>semantic search</strong> directly within SQL:</p><pre>SELECT doc_id, SUBSTR(content, 1, 200)<br>FROM knowledge_base<br>ORDER BY VECTOR_DISTANCE(embedding, :query_vector USING COSINE)<br>FETCH FIRST 5 ROWS ONLY;</pre><p>The ability to perform similarity queries inside the database removes the need for external vector stores such as Pinecone or FAISS, offering a unified data foundation with enterprise-grade consistency and performance.</p><p><strong>5. Enterprise Implications</strong></p><p>The architectural convergence introduced by Oracle 26ai has significant strategic implications:</p><p><strong>5.1 Unified Data Plane</strong></p><p>Transactional, analytical, and AI-driven workloads now coexist in a single environment, reducing integration complexity and operational cost.</p><p><strong>5.2 Enhanced Governance and Security</strong></p><p>Select AI operates within the Oracle security framework. Sensitive data never leaves the database unless explicitly authorized, ensuring compliance with enterprise data protection policies.</p><p><strong>5.3 Simplified Application Development</strong></p><p>Developers can implement advanced AI and RAG use cases using standard SQL syntax — without additional middleware or data movement.</p><p><strong>5.4 Performance and Cost Efficiency</strong></p><p>By leveraging Oracle’s mature optimizer, in-memory architecture, and partitioning, vector and semantic operations achieve high throughput and predictable performance.</p><p><strong>6. Practical Applications</strong></p><p>Organizations can apply Oracle 26ai’s semantic capabilities across diverse domains:</p><ul><li><strong>Enterprise Resource Planning (ERP):</strong> Automatically interpret budget overruns, supplier delays, or purchase-order anomalies using semantic search.</li><li><strong>Customer Experience:</strong> Retrieve similar support cases or documents based on contextual similarity.</li><li><strong>Knowledge Management:</strong> Implement intelligent document retrieval and summarization directly from within the database.</li><li><strong>Compliance &amp; Risk:</strong> Identify semantically related records across structured and unstructured repositories.</li></ul><p><strong>7. Security and Trust by Design</strong></p><p>AI-native functionality often raises concerns regarding data privacy.<br> Oracle 26ai addresses these concerns through:</p><ul><li><strong>AI Profiles:</strong> Administrators define which AI models are accessible from which schemas.</li><li><strong>Prompt Governance:</strong> The database masks or omits sensitive schema details in AI interactions.</li><li><strong>Auditing and Observability:</strong> Every AI invocation can be logged and traced for compliance.</li></ul><p>This design ensures that <strong>enterprise AI remains explainable, traceable, and governed.</strong></p><p><strong>8. The Strategic Perspective</strong></p><p>Oracle 26ai does more than add features — it redefines the role of the database in the enterprise technology stack.<br> In an environment where every application increasingly incorporates AI-driven insight, keeping data, logic, and context unified within the database is both an operational and strategic advantage.</p><p>The future of data management is not only analytical; it is <strong>semantic</strong>.<br> The systems that will lead are those capable of understanding relationships <em>and</em> meaning.</p><p><strong>9. Conclusion</strong></p><p><strong>Oracle Database 26ai</strong> introduces a new paradigm where SQL evolves from a language of structure to a language of understanding.<br> By embedding AI capabilities — vector search, natural-language querying, and contextual reasoning — directly into the database kernel, Oracle positions SQL as the foundation for the next generation of intelligent enterprise systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c91b6c017f88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From 23ai to 26ai: Build Real RAG Apps inside Oracle AI Database]]></title>
            <link>https://medium.com/@sertayozer/from-23ai-to-26ai-build-real-rag-apps-inside-oracle-ai-database-d832d062d169?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/d832d062d169</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 09:50:46 GMT</pubDate>
            <atom:updated>2025-10-24T07:26:38.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9p7SznMy9F44GDiqNP3ixA.png" /></figure><p>Oracle <strong>AI Database 26ai</strong> is the long-term successor to 23ai. It bakes vector search, natural-language SQL (Select AI), JSON–Relational Duality, and modern app plumbing straight into the database. You can upgrade from 23ai via the October 2025 RU, no app recertification required. This post shows an end-to-end mini-RAG flow with <strong>VECTOR</strong> columns, <strong>CREATE VECTOR INDEX</strong> (HNSW/IVF), and a quick <strong>Select AI</strong> example.</p><p><strong>Why 26ai matters (in one minute)</strong></p><ul><li><strong>26ai replaces 23ai</strong> and is an LTS track; applying the October 2025 release update moves you onto 26ai features without a full “upgrade project.” Advanced AI (including <strong>AI Vector Search</strong>) is included.</li><li>It’s an <strong>AI-native</strong> database: vectors, documents, spatial, transactional + analytical in one engine, plus modern extras: Apache Iceberg support, Model Context Protocol (MCP), and tight RAG/LLM integration.</li><li>Want to try locally? <strong>Oracle AI Database 26ai Free</strong> gives you a no-cost sandbox</li></ul><h3>Core building blocks you’ll use</h3><ol><li><strong>AI Vector Search</strong><br> A first-class <strong>VECTOR</strong> type, distance functions, and approximate/exact similarity search — no external vector store needed.</li><li><strong>Select AI</strong><br> Ask questions in English; the database invokes an LLM, generates SQL, can run it, and even do RAG over your vector indexes. Works with OCI Generative AI, OpenAI, Anthropic, Cohere, Google, Azure OpenAI, etc.</li><li><strong>JSON Relational Duality</strong><br> Model once, use as JSON <em>and</em> relational without sync jobs — great for app/dev teams.</li></ol><h3>Quick start: a tiny RAG demo in 26ai</h3><p>Scenario: Product docs live in Oracle. We’ll embed text, index vectors (HNSW), and run semantic search. Then we’ll show how <strong>Select AI</strong> can chat with the data.</p><p><strong>Prereqs</strong></p><ul><li>Ensure COMPATIBLE &gt;= 23.4.0 (needed for VECTOR type). <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-ai-vector-search.html">Oracle Docs</a></li><li>26ai or 23ai RU ≥ 23.7 recommended for the latest vector goodies. <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-ai-vector-search.html">Oracle Docs</a></li></ul><p><strong>Create a table with a VECTOR column</strong></p><pre>CREATE TABLE docs (<br>  doc_id     NUMBER PRIMARY KEY,<br>  doc_text   CLOB,<br>  embedding  VECTOR<br>);</pre><p>This uses Oracle’s native VECTOR type—store embeddings right next to business data.</p><p><strong>Load embeddings</strong></p><p>You can generate embeddings outside the DB (OpenAI, Cohere, HF, etc.) or <strong>in-database</strong> via ONNX runtime and SQL if your model is ONNX-compatible. Either way, insert vectors into embedding</p><pre>INSERT INTO docs (doc_id, doc_text, embedding)<br>VALUES (<br>  1001,<br>  &#39;How to create a purchase order and route for approval…&#39;,<br>  VECTOR(&#39;[0.012, -0.034, ...]&#39;)   -- your float array here<br>);</pre><p><strong>Create a vector index (HNSW or IVF)</strong></p><p><strong>HNSW</strong> (in-memory neighbor graph) is a great default:</p><pre>CREATE VECTOR INDEX docs_hnsw_idx<br>ON docs (embedding)<br>ORGANIZATION INMEMORY NEIGHBOR GRAPH<br>DISTANCE COSINE<br>WITH TARGET ACCURACY 90<br>PARAMETERS (TYPE HNSW, NEIGHBORS 40, EFCONSTRUCTION 500);</pre><p><strong>IVF</strong> (partitioned) is another option:</p><pre>CREATE VECTOR INDEX docs_ivf_idx<br>ON docs (embedding)<br>ORGANIZATION NEIGHBOR PARTITIONS<br>DISTANCE COSINE<br>WITH TARGET ACCURACY 90<br>PARAMETERS (TYPE IVF, NEIGHBOR PARTITIONS 64);</pre><p>These are the official 26ai/23ai vector index syntaxes and knobs</p><p><strong>Run a semantic (nearest-neighbor) search</strong></p><pre>-- :qvec is a bind variable with your query embedding vector<br>SELECT doc_id, SUBSTR(doc_text, 1, 120) AS snippet<br>FROM docs<br>ORDER BY VECTOR_DISTANCE(embedding, :qvec USING COSINE)<br>FETCH FIRST 5 ROWS ONLY;</pre><p>Cosine is the default metric if not specified; aligning the metric with your embeddings ensures the index can be used.</p><p><strong>Add natural-language with Select AI</strong></p><p>Want business users to just ask, <em>“Show top 10 suppliers by PO value last quarter”</em>? That’s what <strong>Select AI</strong> is for.</p><ol><li>Configure an AI profile (one-time) for your LLM provider (OCI GenAI, OpenAI, Anthropic, etc.).</li><li>Use the AI keyword in a SELECT to chat and/or generate SQL.</li></ol><pre>-- After creating an AI profile &amp; grants per docs<br>SELECT AI<br>  PROMPT &#39;List the last 10 items we purchased with unit price and supplier;<br>          use the purchasing and items tables; return nice column names&#39;<br>FROM   dual;</pre><p>Select AI can also integrate with your vector indexes for <strong>RAG</strong>, and it has admin controls to avoid sending sensitive schema data to the LLM.</p><p><strong>Beyond the basics: developer candy in 26ai</strong></p><ul><li><strong>AppDev plumbing</strong>: DRCP/PRCP improvements, reactive JDBC/R2DBC, pipelining, Java virtual threads — better throughput for microservices.</li><li><strong>LangChain/LlamaIndex integrations</strong> for Oracle AI Vector Search providers.</li><li><strong>Observability</strong>: Exporters for Prometheus/Grafana; Kubernetes-friendly.</li></ul><p><strong>When to use what?</strong></p><ul><li>Use <strong>Vector + Index</strong> for semantic search, recommendations, dedup, similarity joins.</li><li>Use <strong>Select AI</strong> for text-to-SQL, data exploration, and chat UX; add <strong>RAG</strong> when answers must cite your freshest rows/documents.</li><li>Use <strong>JSON Relational Duality</strong> when your app wants JSON flexibility but your enterprise still needs relational integrity and SQL.</li></ul><p><strong>References</strong></p><ul><li>Oracle news: <strong>26ai replaces 23ai</strong> (Oct 14, 2025). <a href="https://www.oracle.com/news/announcement/ai-world-database-26ai-powers-the-ai-for-data-revolution-2025-10-14/?utm_source=chatgpt.com">Oracle+1</a></li><li><strong>AI Vector Search</strong> overview &amp; VECTOR type. <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-ai-vector-search.html">Oracle Docs</a></li><li><strong>CREATE VECTOR INDEX</strong> syntax &amp; HNSW/IVF parameters. <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/create-vector-index.html?utm_source=chatgpt.com">Oracle Docs+2Oracle Docs+2</a></li><li><strong>Select AI</strong> docs &amp; examples. <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/sql-generation-ai-autonomous.html?utm_source=chatgpt.com">Oracle Docs+1</a></li><li><strong>JSON Relational Duality</strong> blog. <a href="https://blogs.oracle.com/database/post/json-relational-duality-app-dev?utm_source=chatgpt.com">Oracle Blogs</a></li><li><strong>26ai product page</strong> (AI-native features, MCP/Iceberg). <a href="https://www.oracle.com/database/ai-native-database-26ai/?utm_source=chatgpt.com">Oracle</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d832d062d169" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI Copilot for Oracle ERP with PL/SQL, REST, and Vector Search]]></title>
            <link>https://medium.com/@sertayozer/building-an-ai-copilot-for-oracle-erp-with-pl-sql-rest-and-vector-search-7828c7255baf?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/7828c7255baf</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 09:11:46 GMT</pubDate>
            <atom:updated>2025-10-07T09:11:46.209Z</atom:updated>
            <content:encoded><![CDATA[<p>This guide shows how to build a lightweight “ERP Copilot” that answers natural-language questions over Oracle ERP data and notes — securely from inside the database — using PL/SQL services, REST, and (when available) Oracle AI Vector Search.</p><h3>Architecture at a glance</h3><ol><li><strong>Ingest:</strong> Extract short text chunks (PO headers/lines notes, AP invoice descriptions, item attribute texts, SR notes).</li><li><strong>Embed:</strong> Create vector embeddings per chunk (in-DB call or external microservice).</li><li><strong>Index:</strong> Store in a VECTOR column with a vector index for fast similarity.</li><li><strong>Retrieve:</strong> For a user question, compute a query embedding, run similarity search + SQL filters.</li><li><strong>Answer:</strong> Compose a grounded answer (citations, links to EBS pages). Optionally call an LLM to paraphrase.</li></ol><pre>User → (REST) → PL/SQL API → Vector Search + SQL → (optional LLM) → Answer + deep links<br></pre><p><strong>Data model</strong></p><pre>CREATE TABLE ERP_TEXT_CHUNKS (<br>  id             NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,<br>  doc_type       VARCHAR2(30),    -- &#39;PO&#39;, &#39;AP&#39;, &#39;ITEM&#39;, &#39;SR&#39;<br>  doc_id         NUMBER,<br>  org_id         NUMBER,<br>  chunk_seq      NUMBER,<br>  chunk_text     CLOB,<br>  embedding      VECTOR(1536),<br>  created_at     TIMESTAMP DEFAULT SYSTIMESTAMP<br>);<br><br>CREATE INDEX ERP_TEXT_CHUNKS_VEC_IDX ON ERP_TEXT_CHUNKS (embedding)<br>INDEXTYPE IS VECTOR_INDEX;  -- name may differ by release</pre><p>If your DB version doesn’t support vector columns, keep embeddings as binary/base64 in a BLOB and compute similarity in PL/SQL or externalize the search in a tiny sidecar — then still serve results through the DB.</p><h3>Secure embedding workflow</h3><ul><li><strong>Option A: In-DB model call</strong> (where supported): grant execute on the model package to a service schema.</li><li><strong>Option B: External service:</strong> create a database credential and a UTL_HTTP callout package; restrict via ACL.</li></ul><pre>CREATE OR REPLACE PACKAGE erp_embedder AS<br>  PROCEDURE upsert_chunk(p_doc_type VARCHAR2, p_doc_id NUMBER, p_text CLOB);<br>END;<br>/<br><br>CREATE OR REPLACE PACKAGE BODY erp_embedder AS<br>  PROCEDURE upsert_chunk(p_doc_type VARCHAR2, p_doc_id NUMBER, p_text CLOB) IS<br>    v_emb VECTOR(1536);<br>  BEGIN<br>    -- 1) split p_text into &lt;= 1–2KB chunks (omitted for brevity)<br>    -- 2) call embedding provider (UTL_HTTP or in-DB) to fill v_emb<br>    -- 3) MERGE into ERP_TEXT_CHUNKS<br>    NULL;<br>  END;<br>END;<br>/</pre><p>Schedule this in a nightly job to refresh from ERP base tables/views:</p><ul><li>PO headers/lines notes (PO_HEADERS_ALL, PO_LINES_ALL with note views)</li><li>AP invoice descriptions/hold reasons</li><li>Item catalog/attributes (EGO/Item Master views)</li><li>Service Request notes if you use Oracle Service modules</li></ul><h3>Retrieval API (PL/SQL + ORDS/REST)</h3><p>Expose a REST endpoint /copilot/search that accepts { &quot;q&quot;: &quot;...&quot;, &quot;filters&quot;: {...} }.</p><pre>CREATE OR REPLACE PACKAGE erp_copilot AS<br>  TYPE t_result IS RECORD (<br>    doc_type   VARCHAR2(30),<br>    doc_id     NUMBER,<br>    score      NUMBER,<br>    snippet    CLOB<br>  );<br>  TYPE t_result_tab IS TABLE OF t_result;<br>  FUNCTION search(q_embedding VECTOR, p_org_id NUMBER DEFAULT NULL, p_type VARCHAR2 DEFAULT NULL)<br>    RETURN t_result_tab PIPELINED;<br>END;<br>/<br><br>CREATE OR REPLACE PACKAGE BODY erp_copilot AS<br>  FUNCTION search(q_embedding VECTOR, p_org_id NUMBER, p_type VARCHAR2)<br>    RETURN t_result_tab PIPELINED<br>  IS<br>  BEGIN<br>    FOR r IN (<br>      SELECT doc_type, doc_id,<br>             VECTOR_DISTANCE(embedding, q_embedding USING COSINE) AS score,<br>             SUBSTR(chunk_text,1,400) AS snippet<br>      FROM ERP_TEXT_CHUNKS<br>      WHERE (p_org_id IS NULL OR org_id = p_org_id)<br>        AND (p_type   IS NULL OR doc_type = p_type)<br>      ORDER BY score<br>      FETCH FIRST 20 ROWS ONLY<br>    ) LOOP<br>      PIPE ROW (t_result(r.doc_type, r.doc_id, r.score, r.snippet));<br>    END LOOP;<br>    RETURN;<br>  END;<br>END;<br>/<br></pre><p>Then publish with <strong>Oracle REST Data Services (ORDS)</strong>:</p><ul><li>Map POST /copilot/search → PL/SQL block that:</li></ul><ol><li>Receives natural-language q</li><li>Calls embedder to get q_embedding</li><li>Calls erp_copilot.search</li><li>Returns JSON with deep links (EBS forms URL or custom APEX page)</li></ol><h3>Adding grounded reasoning</h3><p>Even without an external LLM, you can produce useful answers:</p><ul><li>Return <strong>why it matched</strong> (top terms or nearest chunks)</li><li>Provide <strong>direct navigation links</strong> to the ERP document</li><li>Aggregate duplicates (same doc_type/doc_id across multiple chunks)</li></ul><p>If you do add an LLM, keep it <strong>stateless</strong> and <strong>grounded</strong>:</p><ul><li>Prompt with only the retrieved snippets</li><li>Include explicit “do not guess” instructions</li><li>Mask/obfuscate sensitive fields if policy requires</li></ul><h3>Example: “Why is PO 12345 late?”</h3><ul><li>Retrieve related notes + ASN events</li><li>Join to receipts/shipments to calculate delay deltas</li><li>Return a single sentence summary + evidence list</li></ul><pre>SELECT pol.po_header_id, pol.line_num,<br>       (MAX(rcv.transaction_date) - pol.promised_date) AS days_late<br>FROM po_lines_all pol<br>LEFT JOIN rcv_transactions rcv<br>  ON rcv.po_line_id = pol.po_line_id<br>WHERE pol.po_header_id = 12345<br>GROUP BY pol.po_header_id, pol.line_num;<br></pre><p>Then enrich with vector-retrieved notes explaining the cause (customs hold, vendor shutdown, missing COO).</p><h3>Security &amp; governance checklist</h3><ul><li><strong>Least privilege:</strong> a service schema with SELECT on read-only views; no DDL.</li><li><strong>Auditing:</strong> log every query (user, purpose, rowcount).</li><li><strong>Data retention:</strong> purge embeddings when source docs are deleted/expired.</li><li><strong>PII/Secrets:</strong> redact before embedding; store only necessary text.</li></ul><h3>Rollout plan (6–8 weeks)</h3><ol><li><strong>Week 1–2:</strong> Ingest &amp; embedding pipeline on one document type (PO notes).</li><li><strong>Week 3–4:</strong> REST API + APEX/EBS page surfacing results.</li><li><strong>Week 5–6:</strong> Add AP invoices + SR notes; add filters &amp; citations.</li><li><strong>Week 7–8:</strong> Pilot with 10–20 power users; measure search success &amp; time saved.</li></ol><h3>KPIs to track</h3><ul><li>Top-k hit rate on real queries</li><li>Average time-to-answer vs. manual navigation</li><li>Reduction in duplicate vendor queries</li><li>Planner satisfaction (quick pulse survey)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7828c7255baf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From SQL to Smart: Practical AI Inside the Oracle ERP Database]]></title>
            <link>https://medium.com/@sertayozer/from-sql-to-smart-practical-ai-inside-the-oracle-erp-database-1e8c08206d2f?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e8c08206d2f</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 09:04:22 GMT</pubDate>
            <atom:updated>2025-10-07T09:04:22.673Z</atom:updated>
            <content:encoded><![CDATA[<p>You don’t need a separate ML stack to get value from AI in Oracle ERP. With features like Oracle Machine Learning for SQL, built-in SQL analytics, and (on newer versions) vector search, you can deliver anomaly detection, forecasting, and natural-language insights <strong>without moving data out of the database</strong>.</p><p><strong>Why AI belongs <em>in</em> the database</strong></p><p>In most ERP programs, the biggest tax on AI projects is <strong>data gravity</strong>: extracting, cleansing, and securing sensitive financial and supply-chain data across systems. Running ML where the data already lives reduces latency, risk, and cost — and fits enterprise controls (roles, grants, audit).</p><p><strong>Key advantages:</strong></p><ul><li><strong>No data egress:</strong> Keep PII/financials inside Oracle security domains.</li><li><strong>Operationalize faster:</strong> SQL-first pipelines embed into nightly jobs and concurrent programs.</li><li><strong>Governance:</strong> Reuse DB roles, VPD/RLS, and auditing already in place for ERP.</li></ul><p><strong>The three AI patterns that work today</strong></p><p><strong>1 - Anomaly detection</strong> on AP/PO/Inventory flows</p><p><strong>2 - Forecasting</strong> (demand, lead time, cash collection)</p><p><strong>3 - Retrieval-augmented assistance</strong> for analysts (search through notes, item attributes, support cases)</p><p>You can implement #1 and #2 with <strong>Oracle Machine Learning for SQL</strong> (OML4SQL) or classic DBMS_DATA_MINING (depending on edition/version), and #3 with <strong>AI Vector Search</strong> (available on newer releases and Autonomous Database). Exact package names vary by version—use what your licensed database version supports.</p><p><strong>Pattern 1: AP/PO anomaly detection in pure SQL</strong></p><p>Goal: flag suspicious vendor invoices (duplicate amounts, split POs, weekend approvals).</p><pre>CREATE MATERIALIZED VIEW AP_INVOICE_FEATURES AS<br>SELECT<br>  ai.invoice_id,<br>  ai.vendor_id,<br>  ai.amount,<br>  ai.invoice_date,<br>  EXTRACT(DOW FROM ai.invoice_date) AS day_of_week,<br>  COUNT(*) OVER (PARTITION BY ai.vendor_id<br>                 ORDER BY ai.invoice_date<br>                 RANGE BETWEEN INTERVAL &#39;90&#39; DAY PRECEDING AND CURRENT ROW) AS vendor_90d_cnt,<br>  AVG(ai.amount) OVER (PARTITION BY ai.vendor_id<br>                       ORDER BY ai.invoice_date<br>                       RANGE BETWEEN INTERVAL &#39;90&#39; DAY PRECEDING AND CURRENT ROW) AS vendor_90d_avg,<br>  CASE WHEN TO_CHAR(ai.invoice_date,&#39;DY&#39;) IN (&#39;SAT&#39;,&#39;SUN&#39;) THEN 1 ELSE 0 END AS is_weekend<br>FROM ap_invoices_all ai;<br></pre><p><strong>Density-based outlier score (SQL analytics idea)</strong></p><pre>WITH z AS (<br>  SELECT<br>    invoice_id,<br>    amount,<br>    vendor_90d_avg,<br>    (amount - vendor_90d_avg) / NULLIF(vendor_90d_avg,0) AS pct_dev<br>  FROM AP_INVOICE_FEATURES<br>)<br>SELECT<br>  invoice_id,<br>  pct_dev,<br>  CASE WHEN ABS(pct_dev) &gt; 0.75 THEN &#39;HIGH&#39; WHEN ABS(pct_dev) &gt; 0.4 THEN &#39;MED&#39; ELSE &#39;LOW&#39; END anomaly_level<br>FROM z<br>ORDER BY ABS(pct_dev) DESC<br>FETCH FIRST 200 ROWS ONLY;</pre><p>If your version includes OML4SQL classification/regression, replace the heuristic with an ML model (e.g., one-class SVM or isolation forest equivalent). Train on “normal” historical invoices; score nightly.</p><p><strong>Pattern 2: Demand or lead-time forecasting inside the DB</strong></p><pre>-- Create a training series per item/org<br>CREATE OR REPLACE VIEW ITEM_DEMAND_SERIES AS<br>SELECT<br>  item_id,<br>  organization_id,<br>  TRUNC(order_date,&#39;MM&#39;) AS month_start,<br>  SUM(quantity) AS qty<br>FROM so_lines<br>GROUP BY item_id, organization_id, TRUNC(order_date,&#39;MM&#39;);</pre><p>If OML4SQL time-series is available in your environment, you can:</p><ul><li>Split into train/test in SQL</li><li>Fit a model (e.g., ETS/ARIMA offered by your version)</li><li>Store forecasts into a table for planners to consume in EBS forms or BI Publisher</li></ul><p>If not, start with <strong>moving averages</strong> and <strong>Holt-Winters-like</strong> smoothing in SQL; it’s surprisingly effective for many SKUs.</p><p><strong>Pattern 3: RAG-style assistance with Vector Search (newer releases)</strong></p><p>Imagine a buyer typing <em>“Show me blanket POs with incoterms FCA and delivery slips delayed &gt; 10 days”</em> and getting a ranked list from free-text notes + structured filters.</p><p><strong>Minimal schema for embeddings</strong> (23ai-style vector column names may vary by patch level):</p><pre>CREATE TABLE DOC_CHUNKS (<br>  id           NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,<br>  source_type  VARCHAR2(30),     -- &#39;PO_NOTE&#39;, &#39;AP_NOTE&#39;, &#39;ITEM_ATTR&#39;<br>  source_id    NUMBER,<br>  chunk_text   CLOB,<br>  embedding    VECTOR(1536)      -- size depends on model you use<br>);<br></pre><p><strong>Index &amp; similarity search</strong> (syntax may vary; adjust to your version)</p><pre>-- Example: cosine similarity search<br>SELECT id, source_type, source_id,<br>       VECTOR_DISTANCE(embedding, :query_embedding USING COSINE) AS score<br>FROM DOC_CHUNKS<br>ORDER BY score<br>FETCH FIRST 20 ROWS ONLY;<br></pre><p>You can generate embeddings:</p><ul><li><strong>Inside DB</strong> if your version exposes embedding models or external model calls</li><li><strong>Outside</strong> (secure service) and load via staging table + MERGE</li></ul><h3>Operationalizing in ERP</h3><ul><li>Nightly job: refresh features/embeddings; score anomalies; write results to control tables.</li><li>Surface results in: EBS OAF pages, APEX, or REST services used by your UI.</li><li>Governance: GRANT read-only views to Finance/Procurement roles; log access.</li></ul><h3>What good looks like</h3><ul><li>&lt;5 min daily pipeline runtime for 1–5M transactional rows</li><li>Lift in audit findings or price-variance detection within first month</li><li>Planners actually use the forecast numbers (measured via adoption in forms/reports)</li></ul><h3>Pitfalls to avoid</h3><ul><li>Over-engineering modeling before you fix <strong>data quality and joins</strong></li><li>Shipping data to external tools without a DPO sign-off</li><li>Not providing explainability (simple features, reason codes, drill-through links)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e8c08206d2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anomaly Detection in Purchase Orders Using Deep Learning Techniques]]></title>
            <link>https://medium.com/@sertayozer/anomaly-detection-in-purchase-orders-using-deep-learning-techniques-e706003289d6?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/e706003289d6</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 14:57:54 GMT</pubDate>
            <atom:updated>2024-10-14T14:57:54.006Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s data-driven landscape, detecting anomalies in purchase orders is vital for maintaining operational integrity and uncovering hidden insights. This article explores the application of deep learning techniques, particularly autoencoders, for efficiently identifying anomalies in purchase order data.</p><p><strong>What is an Anomaly?</strong></p><p>An anomaly is a data point that significantly deviates from the expected pattern. In the context of purchase orders, anomalies can manifest as:</p><ul><li><strong>Unusually High Order Quantity:</strong> A standard order might typically be for 100 units, but an outlier could be for 1,000 units.</li><li><strong>Irregular Pricing:</strong> An item usually priced between $10 and $15 may suddenly appear at $1.</li><li><strong>Unexpected Suppliers:</strong> An order from a supplier that is not typically associated with a specific product.</li></ul><p><strong>Why Detect Anomalies?</strong></p><p>Anomaly detection is crucial for several reasons:</p><ul><li><strong>Fraud Prevention:</strong> Identifying fraudulent orders that do not conform to established patterns can save significant costs.</li><li><strong>Operational Efficiency:</strong> Spotting errors in order placements can enhance inventory management and reduce waste.</li><li><strong>Supplier Assessment:</strong> Understanding anomalies can help in evaluating supplier reliability and performance.</li></ul><h3>Using Deep Learning for Anomaly Detection</h3><h3>Autoencoders</h3><p>Autoencoders are a type of neural network that learn to compress and reconstruct data. They can effectively be used for anomaly detection by identifying reconstruction errors. Here’s how it works:</p><ol><li><strong>Data Encoding:</strong> The autoencoder compresses the input data into a lower-dimensional space.</li><li><strong>Data Decoding:</strong> The compressed representation is then reconstructed back to the original input size.</li><li><strong>Anomaly Detection:</strong> If the reconstruction error (the difference between the input and the reconstructed output) exceeds a certain threshold, the data point is flagged as an anomaly.</li></ol><h3>Step-by-Step Implementation in Python</h3><p>Let’s implement an autoencoder for detecting anomalies in purchase orders.</p><h4>Step 1: Import Necessary Libraries</h4><pre>import numpy as np<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>from sklearn.preprocessing import StandardScaler<br>from keras.models import Sequential<br>from keras.layers import Dense</pre><h4>Step 2: Create a Synthetic Dataset</h4><p>We’ll create a synthetic dataset representing normal purchase orders and a few anomalies.</p><pre># Create synthetic data<br>normal_data = np.random.normal(loc=100, scale=10, size=(300, 2))  # Normal purchase orders<br>anomalies = np.array([[1000, 5], [1100, 6], [1200, 7]])  # Anomalies<br>data = np.vstack([normal_data, anomalies])<br><br># Visualize the dataset<br>plt.scatter(data[:, 0], data[:, 1], c=&#39;b&#39;, marker=&#39;o&#39;, s=25)<br>plt.title(&quot;Synthetic Purchase Order Dataset&quot;)<br>plt.xlabel(&quot;Quantity Ordered&quot;)<br>plt.ylabel(&quot;Price&quot;)<br>plt.grid()<br>plt.show()</pre><h4>Step 3: Preprocess the Data</h4><p>Before training the autoencoder, we need to standardize the data.</p><pre># Standardize the dataset<br>scaler = StandardScaler()<br>data_scaled = scaler.fit_transform(data)</pre><h4>Step 4: Build the Autoencoder</h4><p>We will construct a simple autoencoder architecture.</p><pre># Build the autoencoder<br>autoencoder = Sequential()<br>autoencoder.add(Dense(8, activation=&#39;relu&#39;, input_shape=(data_scaled.shape[1],)))<br>autoencoder.add(Dense(4, activation=&#39;relu&#39;))<br>autoencoder.add(Dense(8, activation=&#39;relu&#39;))<br>autoencoder.add(Dense(data_scaled.shape[1], activation=&#39;sigmoid&#39;))<br><br># Compile the autoencoder<br>autoencoder.compile(optimizer=&#39;adam&#39;, loss=&#39;mean_squared_error&#39;)</pre><h4>Step 5: Train the Autoencoder</h4><p>We will train the autoencoder on the normal purchase orders only.</p><pre># Train the autoencoder<br>normal_data_scaled = data_scaled[:300]  # Only use normal data for training<br>autoencoder.fit(normal_data_scaled, normal_data_scaled, epochs=100, batch_size=10, shuffle=True)</pre><h4>Step 6: Detect Anomalies</h4><p>After training, we can use the autoencoder to predict the data and compute reconstruction errors.</p><pre># Predict the data<br>reconstructed = autoencoder.predict(data_scaled)<br>reconstruction_error = np.mean(np.power(data_scaled - reconstructed, 2), axis=1)<br><br># Set a threshold for anomalies<br>threshold = 3 * np.std(reconstruction_error)<br>anomalies_detected = reconstruction_error &gt; threshold</pre><h4>Step 7: Visualize the Anomalies</h4><p>Finally, we will visualize the detected anomalies.</p><pre># Visualize the anomalies<br>plt.scatter(data[:, 0], data[:, 1], c=&#39;b&#39;, marker=&#39;o&#39;, s=25)<br>plt.scatter(data[anomalies_detected, 0], data[anomalies_detected, 1], c=&#39;r&#39;, marker=&#39;x&#39;, s=50, label=&#39;Anomalies&#39;)<br>plt.title(&quot;Anomaly Detection in Purchase Orders Using Autoencoders&quot;)<br>plt.xlabel(&quot;Quantity Ordered&quot;)<br>plt.ylabel(&quot;Price&quot;)<br>plt.legend()<br>plt.grid()<br>plt.show()</pre><h3>Understanding the Results</h3><p>In the visualization:</p><ul><li><strong>Blue Dots:</strong> Represent normal purchase orders.</li><li><strong>Red Xs:</strong> Indicate detected anomalies.</li></ul><h3>Conclusion</h3><p>Using deep learning techniques, specifically autoencoders, provides a robust method for anomaly detection in purchase order data. By following the step-by-step implementation outlined above, organizations can integrate autoencoders into their data analysis processes, enhancing their ability to identify and respond to anomalies effectively. This proactive approach can lead to improved operational efficiency and reduced risks in supply chain management.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e706003289d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anomaly Detection in Purchase Orders Using DBSCAN]]></title>
            <link>https://medium.com/@sertayozer/anomaly-detection-in-purchase-orders-using-dbscan-b6d9534312aa?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6d9534312aa</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 14:00:33 GMT</pubDate>
            <atom:updated>2024-10-14T14:00:33.536Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of big data, anomaly detection is vital for uncovering hidden insights and ensuring data integrity. This blog will explore unsupervised machine learning techniques, specifically DBSCAN, to identify anomalies in purchase order data without the need for labeled datasets.</p><h3>What is an Anomaly?</h3><p>An anomaly in purchase orders can be defined as any order that significantly deviates from typical purchasing behavior. Here are some examples:</p><ul><li><strong>High Order Quantity:</strong> A store typically orders 100 units of a product, but suddenly places an order for 1,000 units.</li><li><strong>Unusual Pricing:</strong> An item that usually costs between $10 and $15 is suddenly ordered at $1.</li><li><strong>Unexpected Suppliers:</strong> An order that comes from a supplier not typically used for that product category.</li></ul><h3>What is Anomaly Detection?</h3><p>Anomaly detection is the process of identifying data points that differ significantly from the majority of the dataset. It is crucial in ensuring the quality and security of data across various domains, including finance, healthcare, and supply chain management.</p><h3>Example of Anomaly Detection in Purchase Orders</h3><ul><li><strong>Normal Behavior:</strong> A retail store has consistent purchasing patterns, with predictable quantities ordered weekly and stable supplier relationships.</li><li><strong>Anomaly:</strong> A sudden spike in orders for a product that usually sees low demand or a shift in supplier that has not been used previously.</li></ul><h3>Use Cases of Anomaly Detection in Purchase Orders</h3><ul><li><strong>Fraud Detection:</strong> Identifying fraudulent purchase orders that deviate from usual patterns.</li><li><strong>Inventory Management:</strong> Spotting unexpected orders that could indicate stock issues or vendor errors.</li><li><strong>Supplier Analysis:</strong> Monitoring supplier performance and identifying anomalies in order fulfillment.</li></ul><h3>DBSCAN for Anomaly Detection</h3><p>DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is an effective algorithm for detecting anomalies by grouping similar data points and identifying points that fall outside these groups.</p><h3>How DBSCAN Works</h3><ol><li><strong>Select a Starting Point:</strong> Begin with a randomly chosen data point from the dataset.</li><li><strong>Define Epsilon and Min_Samples:</strong> Specify a radius (Epsilon) and a minimum number of points (Min_Samples) required to form a cluster.</li><li><strong>Check Neighboring Points:</strong> Examine all points within the defined radius around the selected point.</li><li><strong>Form a Cluster:</strong> If the number of neighboring points meets the Min_Samples requirement, a cluster is formed.</li><li><strong>Expand the Cluster:</strong> Repeat the process for all points in the newly formed cluster until no more points can be added.</li><li><strong>Identify Outliers:</strong> Points that are not included in any cluster are classified as outliers.</li></ol><h3>Step-by-Step Implementation in Python</h3><p>Here’s how to apply DBSCAN for anomaly detection in purchase order data using Python:</p><p><strong>Step 1: Import Necessary Libraries</strong></p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br>from sklearn.cluster import DBSCAN<br>from sklearn.datasets import make_blobs</pre><p><strong>Step 2: Create a Synthetic Dataset</strong></p><p>Assuming we have data on purchase orders (quantity and price), we create a synthetic dataset:</p><pre># Create a synthetic dataset with normal and anomalous purchase orders<br>n_samples = 300<br>X, y = make_blobs(n_samples=n_samples, centers=2, random_state=42, cluster_std=1.0)<br><br># Add some anomalies (high quantity and low price orders)<br>anomalies = np.array([[1000, 5], [1100, 6], [1200, 7]])<br>X = np.vstack([X, anomalies])<br></pre><p><strong>Step 3: Visualize the Dataset</strong></p><pre># Visualize the dataset<br>plt.scatter(X[:, 0], X[:, 1], c=&#39;b&#39;, marker=&#39;o&#39;, s=25)<br>plt.title(&quot;Synthetic Purchase Order Dataset&quot;)<br>plt.xlabel(&quot;Quantity Ordered&quot;)<br>plt.ylabel(&quot;Price&quot;)<br>plt.show()</pre><p><strong>Step 4: Apply DBSCAN for Anomaly Detection</strong></p><pre># Apply DBSCAN for anomaly detection<br>dbscan = DBSCAN(eps=50, min_samples=5)  # Adjust epsilon and min_samples as needed<br>labels = dbscan.fit_predict(X)<br><br># Anomalies are points with label -1<br>anomalies = X[labels == -1]<br></pre><p><strong>Step 5: Visualize the Anomalies</strong></p><pre># Visualize the anomalies<br>plt.scatter(X[:, 0], X[:, 1], c=&#39;b&#39;, marker=&#39;o&#39;, s=25)<br>plt.scatter(anomalies[:, 0], anomalies[:, 1], c=&#39;r&#39;, marker=&#39;x&#39;, s=50, label=&#39;Anomalies&#39;)<br>plt.title(&quot;Anomaly Detection in Purchase Orders&quot;)<br>plt.xlabel(&quot;Quantity Ordered&quot;)<br>plt.ylabel(&quot;Price&quot;)<br>plt.legend()<br>plt.show()</pre><p><strong>Step 6: Print the Identified Anomalies</strong></p><pre># Print the identified anomalies<br>print(&quot;Identified Anomalies:&quot;)<br>print(anomalies)</pre><p><strong>Conclusion</strong></p><p>DBSCAN is a powerful tool for anomaly detection in purchase order data, providing a systematic approach to uncovering outliers. By following the step-by-step guide and implementing the provided code, you can effectively integrate DBSCAN into your data analysis processes, enhancing your ability to identify anomalies and make informed decisions based on the insights gained from purchase orders.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6d9534312aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NLP kullanarak Jaccard Benzerliği ve Jaccard Dizini]]></title>
            <link>https://medium.com/@sertayozer/nlp-kullanarak-jaccard-benzerli%C4%9Fi-ve-jaccard-dizini-8f0a7a672291?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f0a7a672291</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 11:09:25 GMT</pubDate>
            <atom:updated>2023-12-20T11:09:25.320Z</atom:updated>
            <content:encoded><![CDATA[<p>Jaccard Uzaklığı ve Jaccard Benzerliği (Jaccard İndeksi olarak da bilinir), Küme Teorisindeki iki küme arasındaki benzerliğin ölçümüdür. Jaccard Benzerlik, iki kelime veya cümle arasında belirli bir seviyeye kadar benzerlik ölçüsü verebildiğinden Doğal Dil İşleme’de oldukça faydalıdır. Jaccard Benzerliği, iki küme arasındaki benzerliğin bir ölçüsüdür; bu, Jaccard Benzerliği değeri ne kadar yüksek olursa, iki kümenin de o kadar benzer olduğu anlamına gelir. Jaccard Uzaklığı ise Jaccard Benzerliğinin karşılığıdır ve iki kümenin ne kadar farklı olduğunun bir ölçüsüdür. İki set arasındaki mesafeyi hesaplar. Dolayısıyla değer düştükçe iki küme birbirine daha yakın veya daha benzer olur.</p><p>Jaccard Benzerliği ve Jaccard Uzaklığı kavramı tamamen Küme Teorisine dayanmaktadır ve bunları hesaplamak için temel Küme İşlemlerini kullanır. Aşağıdaki şekilde formüle edilmiştir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/0*leaP_QyarE6LRl0h.png" /><figcaption>Jaccard Benzerlik Formülü</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/0*uvBjIEv13voNDdqg.png" /><figcaption>Jaccard Uzaklık Formülü</figcaption></figure><p>Jaccard benzerlik formülünde pay, A ve B kümelerindeki ortak eleman sayısı, A ve B kümesinin kesişimidir. Payda, A ve B kümelerindeki toplam eleman sayısı, A ve B kümesinin birleşimidir. Burada kümelerin kullanıldığına dikkat edilmeli, dolayısıyla küme kurallarına da uyulması gerekiyor. Sıra sayıları alınmadan önce Kesişme ve Birleşimdeki yinelenen öğeler kümeden çıkarılır.</p><p>Jaccard uzaklık formülünde paydaki operatör simetrik farktır. <a href="https://www-askpython-com.translate.goog/python/set/python-set?_x_tr_sl=en&amp;_x_tr_tl=tr&amp;_x_tr_hl=tr&amp;_x_tr_pto=wapp">Bu makaleden</a> simetrik farktaki eleman sayısının temel olarak birlikteki eleman sayısı ile kesişmedeki eleman sayısı arasındaki fark olduğu öğrenilebilir . Bunu yukarıdaki formülde simetrik farkın değeri olarak koymak aşağıdaki sonucu verir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*6WQVXyjpHS3OlUcK.png" /><figcaption>Simetrik Fark Değeri Koyduktan Sonra Jaccard Uzaklık Formülü</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*Nw5xLYbVr02VTZjM.png" /><figcaption>Jaccard Uzaklık Basitleştirilmiş Formül 1</figcaption></figure><p>Yani temel olarak Jaccard Uzaklığı, iki kümenin Jaccard Benzerliğinin 1&#39;den çıkarılmasıdır. Ancak bu temel formül, Doğal Dil İşleme’de iki kelime/cümle arasındaki benzerliği hesaplamak için yeterli değildir. Sebebini anlamak için Jaccard Distance’ın Python’da uygulanması gerekiyor ve ardından birkaç kelimeyle elde edilen sonuçlar verimsiz çıktıyı açıklayacak. Doğal Dil İşleme’de iki kelime/cümle arasındaki benzerliği hesaplamak için Jaccard Benzerliği ve Jaccard Uzaklığının kullanılacaktır.</p><h3>Jaccard Benzerliği ve Jaccard Uzaklığının Uygulanması</h3><p>Burada uygulama için Python veri yapısı kümeleri kullanılacaktır. Kümeler listelerdir ancak yinelenen öğeler içermezler. Bir liste set() fonksiyonu kullanılarak sete dönüştürülebilir. Jaccard Benzerliğinin uygulanması aşağıda gösterilmiştir:</p><p><strong>def</strong> JaccardSimilarity(firstset,secondset):</p><p>list1<strong>=</strong>list(firstset)</p><p>list2<strong>=</strong>list(secondset)</p><p>union<strong>=</strong>0</p><p>intersection<strong>=</strong>0</p><p>set1<strong>=</strong>set(list1)</p><p>set2<strong>=</strong>set(list2)</p><p><strong>for</strong> element <strong>in</strong> set1:</p><p><strong>if</strong> element <strong>in</strong> set2:</p><p>intersection<strong>=</strong>intersection<strong>+</strong>1</p><p>unionlist<strong>=</strong>list1<strong>+</strong>list2</p><p>unionset<strong>=</strong>set(unionlist)</p><p>union<strong>=</strong>len(unionset)</p><p>js<strong>=</strong>intersection<strong>/</strong>union</p><p><strong>return</strong> js</p><p>Yukarıdaki kod parçasında görüldüğü gibi JaccardSimilarity() fonksiyonunun girdileri yani birinci set ve ikinci set öncelikle listelere dönüştürülür ve listeler üzerinde çalışılır. Bu, devam etmeden önce dizeler veya tuple’lar gibi diğer her türlü veri yapısını listeye dönüştürmek için yapılır. Birleşim ve kesişim değişkenleri, birleşim ve kesişim kümelerindeki öğe sayısını tutar. Amaca ulaşmak için Set veri yapısının union ve kesişme işlevlerinin de kullanılabileceği belirtilmelidir, ancak burada daha iyi açıklama için ayrı ayrı uygulanmıştır. Her iki liste de kümelere dönüştürülür ve bu listelerdeki yinelenen öğeler elenir. Şimdi ilk kümedeki her öğe yinelenir ve ikinci kümede bulunursa kesişim değişkeni 1 artırılır. Her iki listenin birleştirilmiş kümesi olan birleşim kümesi adı verilen başka bir küme oluşturulur. Uzunluğu birleşim değişkeni olarak atanır. Jaccard benzerliği kesişim değişkeninin birleşim değişkenine bölünmesiyle elde edilir.</p><p>Yukarıda açıklandığı gibi Jaccard Uzaklığı, 1&#39;den çıkarılan Jaccard Benzerliğinden başka bir şey değildir. Dolayısıyla Jaccard Uzaklığı’nın Uygulanması aşağıdaki gibi olacaktır:</p><p><strong>def</strong> JaccardDistance(word1,word2):</p><p><strong>return</strong> 1<strong>-</strong>JaccardSimilarity(word1,word2)</p><p>Yukarıdaki işlev, halihazırda uygulanmış olan JaccardSimialrity() işlevini kullanır. Şimdi, çıktılarını kontrol etmek için JaccardSimilarity() ve JaccardDistance() işlevlerine girdi olarak aşağıdaki iki liste sağlanacaktır:</p><p>set1<strong>=</strong>[1,1,4,5,7,9,0,6,5]</p><p>set2<strong>=</strong>[9,6,3,6,4,0,1,2,1]</p><p>print(&#39;Jaccard Similarity: &#39;<strong>+</strong>str( JaccardSimilarity(set1,set2)))</p><p>print(&#39;Jaccard Distance: &#39;<strong>+</strong> str(JaccardDistance(set1,set2)))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/0*eXHhTBASWP3YJHfy.png" /><figcaption>Bir Set Üzerinde Jaccard Benzerliği ve Jaccard Uzaklığı Çıktısı</figcaption></figure><p>Çıktı beklendiği gibi. Kümelere dönüştürüldükten sonra listeler {1,4,7,5,9,0,6} ve {1,2,3,4,0,6,9} olur. Birleşimin 9 öğesi vardır {1,4,7,5,9,0,6,2,3} ve bunların kesişimlerinin 5 öğesi vardır {1,4,6,9,0} . Yani JaccardSimilarity() çıktısı 5/9=0,555556 ve JaccardDistance() çıktısı 4/9=0,4444444444 olur.</p><p>Ancak sorun artık iki kelime/cümle arasındaki benzerliği hesaplamak için JaccardSimilarity() işlevi kullanıldığında ortaya çıkıyor. Gerçeği göstermek için birkaç kelime örnek olarak kullanılmıştır. Aşağıdaki kodu çalıştırırken:</p><p>listofwords<strong>=</strong>[&#39;list&#39;,&#39;set&#39;,&#39;tuple&#39;,&#39;jaccard&#39;,&#39;jackal&#39;,&#39;distance&#39;,&#39;index&#39;,&#39;article&#39;,&#39;python&#39;,&#39;mobile&#39;,&#39;computer&#39;,&#39;square&#39;]</p><p><strong>for</strong> word <strong>in</strong> listofwords:</p><p>print(word)</p><p>print(JaccardSimilarity(word,word))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/0*pELRBn_H-6_6y33a.png" /><figcaption>Aynı Giriş Kelimelerinde Jaccard Benzerlik Çıktısı</figcaption></figure><p>listofwords<strong>=</strong>[&#39;list&#39;,&#39;set&#39;,&#39;tuple&#39;,&#39;jaccard&#39;,&#39;jackal&#39;,&#39;distance&#39;,&#39;index&#39;,&#39;article&#39;,&#39;python&#39;,&#39;mobile&#39;,&#39;computer&#39;,&#39;square&#39;]</p><p>fakewords<strong>=</strong>[&#39;lits&#39;,&#39;set&#39;,&#39;tulp&#39;,&#39;jakard&#39;,&#39;jakal&#39;,&#39;ditsance&#39;,&#39;idnex&#39;,&#39;articel&#39;,&#39;typhoon&#39;,&#39;mobeel&#39;,&#39;computer&#39;,&#39;sqaure&#39;]</p><p><strong>for</strong> i <strong>in</strong> range(len(listofwords)):</p><p>print(listofwords[i]<strong>+</strong>&#39; &#39;<strong>+</strong>fakewords[i])</p><p>print(JaccardSimilarity(listofwords[i],fakewords[i]))</p><p>‘Kare’ ve ‘kare’ gibi bu kelimelerden bazılarının küçük farklılıklara sahip olduğunu, ancak ‘kare’nin yanlış yazılış olduğunu ve bu nedenle JaccardSimilarity() işlevinin 1.0 döndürmemesi gerektiğini belirtmek gerekir. Ancak bu koddan gözlemlenen çıktıdır:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/0*dal7c4qAFdPxJ-x3.png" /><figcaption>Jaccard Benzerlik Çıktısı</figcaption></figure><p>jaccard’ ve ‘jakard’ gibi bazı sözcüklerde mükemmel çalışır, ancak ‘index’ ve ‘idnex’ veya ‘article’ ve ‘article’ gibi yanlış yazılan sözcüklerin çoğu için JaccardSimilarity() 1,0 değerini döndürür; bu kabul edilemez. Bu nedenle, Doğal Dil İşleme için JaccardSimilarity()’nin daha katı bir versiyonunun uygulanması gerekmektedir.</p><h3>NLP için Jaccard Benzerliği ve Jaccard Uzaklığı</h3><p>NLP için Jaccard Benzerliğinin ardındaki temel fikir, kelime dizilerinin kümelere dönüştürülmemesi ve bu kelimelerin harflerinin, ancak ve ancak harf her iki listede de aynı konumda mevcutsa Kesişme kümesine dahil edilmesidir. Bu daha katı koşulları kullanan JaccardSimilarity(), kelime benzerliğini eşleştirmede orijinal fikirden daha doğru bir sonuç sağlar. Aşağıdaki kodda gösterilmiştir:</p><p><strong>def</strong> JaccardSimilarityforNLP(word1,word2):</p><p>list1<strong>=</strong>list(word1)</p><p>list2<strong>=</strong>list(word2)</p><p>iter<strong>=</strong>min(len(list1),len(list2))</p><p>union<strong>=</strong>len(set(list1<strong>+</strong>list2))</p><p>intersection<strong>=</strong>0</p><p><strong>for</strong> i <strong>in</strong> range(iter):</p><p><strong>if</strong> list1[i]<strong>==</strong>list2[i]:</p><p>intersection<strong>=</strong>intersection<strong>+</strong>1</p><p>ji<strong>=</strong>intersection<strong>/</strong>union</p><p><strong>return</strong> ji</p><p>Yukarıdaki kod parçacığında kod, sayının daha küçük kelimenin uzunluğu olduğu bir dizi yineleme için bir for döngüsü çalıştırır. Bir harf, her iki listede de aynı konumda bulunuyorsa, kesişim kümesinde kabul edilir. Birleşim daha önce kullanılan yöntemle hesaplanır. Bu algoritmayı kullanan Jaccard Benzerlik, iki kelime arasında daha net bir benzerlik sağlar. Aşağıdaki kodu çalıştırırken görülebilir:</p><p>listofwords<strong>=</strong>[&#39;list&#39;,&#39;set&#39;,&#39;tuple&#39;,&#39;jaccard&#39;,&#39;jackal&#39;,&#39;distance&#39;,&#39;index&#39;,&#39;article&#39;,&#39;python&#39;,&#39;mobile&#39;,&#39;computer&#39;,&#39;square&#39;]</p><p>fakewords<strong>=</strong>[&#39;lits&#39;,&#39;set&#39;,&#39;tulpe&#39;,&#39;jakkard&#39;,&#39;jakcal&#39;,&#39;ditsance&#39;,&#39;idnex&#39;,&#39;articel&#39;,&#39;typhon&#39;,&#39;mobeel&#39;,&#39;computer&#39;,&#39;sqaure&#39;]</p><p><strong>for</strong> i <strong>in</strong> range(len(listofwords)):</p><p>print(listofwords[i]<strong>+</strong>&#39; &#39;<strong>+</strong>fakewords[i])</p><p>print(JaccardSimilarityforNLP(listofwords[i],fakewords[i]))</p><p>Aşağıdaki çıktıyı sağlar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/0*OiV5L10CDt5Rs-oz.png" /></figure><p>Bu, iki farklı kelime arasındaki benzerlik hakkında daha net bir fikir sağlar. Ancak Jaccard Distance’ın aynı uzunluğa sahip kelimeler/cümleler ile daha iyi çalıştığını belirtmek gerekir. <a href="https://translate.google.com/website?sl=en&amp;tl=tr&amp;hl=tr&amp;client=webapp&amp;u=https://stackoverflow.com/questions/2460177/edit-distance-in-python">Mesafeyi Düzenle,</a> farklı uzunluktaki iki kelime arasındaki benzerliği ölçmek için daha iyi bir ölçümdür.</p><p>Ayrıca Jaccard Benzerliğinin aynı kelimeler için her zaman tam 1,0 sağlamadığına da dikkat edilmelidir. Bazen değer 1&#39;den büyük olabilir. Bunun nedeni, tanımlanan kesişimdeki öğe sayısının, iki kelimenin birleşimindeki öğelerden daha fazla olabilmesidir. İki farklı kelimenin Jaccard Benzerliği (bu durumda) mutlaka 1&#39;den küçük olacaktır, ancak aynı iki kelimenin Jaccard Benzerliği 1&#39;e eşit veya 1&#39;den büyük olabilir. Aşağıdaki örnekte görülebilir:</p><p>listofwords<strong>=</strong>[&#39;list&#39;,&#39;set&#39;,&#39;tuple&#39;,&#39;jaccard&#39;,&#39;jackal&#39;,&#39;distance&#39;,&#39;index&#39;,&#39;article&#39;,&#39;python&#39;,&#39;mobile&#39;,&#39;computer&#39;,&#39;square&#39;]</p><p><strong>for</strong> word <strong>in</strong> listofwords:</p><p>print(word)</p><p>print(JaccardSimilarityforNLP(word,word))</p><p>Aşağıdaki çıktıyı üretir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/143/0*Ojc5AV1x-_9yQeLz.png" /></figure><p>İki aynı kelimenin Jaccard Benzerliği (bu durumda) hiçbir zaman 1&#39;den küçük olmayacaktır.</p><p>Jaccard Uzaklığı ve Jaccard Benzerliği gibi ölçümler de NLTK ve SpaCy gibi farklı Python Doğal Dil İşleme kitaplıklarında daha doğru bir şekilde uygulanır. Bu uygulamalar, bu uygulamada atlanan yanlışlıkları da kapatıyor<a href="https://translate.google.com/website?sl=en&amp;tl=tr&amp;hl=tr&amp;client=webapp&amp;u=https://spacy.io/usage/rule-based-matching">.</a></p><h3>Sonuç</h3><p>Doğal Dil İşleme’de kelime tabanlı benzerlik eşleştirmesi oldukça önemlidir. Jaccard Uzaklığı ve Jaccard Benzerliği, iki küme arasındaki benzerliği ölçmek için kullanışlıdır. NLP’deki kelimeler ve cümleler kümeler olarak ele alınabileceğinden, Jaccard Distance ve Jaccard Benzerliği de kelime/cümle benzerliğini ölçmek için bir ölçüm sağlar. Normal Jaccard Benzerliği NLP’deki benzerlikleri ölçmekte başarısız olacağından, başarılı bir uygulama için kuralları daha katı olmalıdır. Eşit uzunluktaki iki kelime/cümlede bir harfin aynı konumda olup olmadığının kontrol edilmesi ve Kesişme kümesindeki yalnızca bu öğelerin dikkate alınması, normal Jaccard Benzerliğine göre daha iyi bir çıktı sağlar.</p><p>Benzerlik eşleştirmesi, Chatbot’lar ve Çevirmenler gibi birçok yararlı NLP tabanlı uygulamaya yol açabilir.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f0a7a672291" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stres, kaygı ve depresyon insanların ruh sağlığını tehdit ediyor.]]></title>
            <link>https://medium.com/@sertayozer/stres-kayg%C4%B1-ve-depresyon-insanlar%C4%B1n-ruh-sa%C4%9Fl%C4%B1%C4%9F%C4%B1n%C4%B1-tehdit-ediyor-8d08ecce9203?source=rss-8f3c621b2e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d08ecce9203</guid>
            <dc:creator><![CDATA[Sertay Ozer]]></dc:creator>
            <pubDate>Wed, 21 Dec 2022 19:02:59 GMT</pubDate>
            <atom:updated>2022-12-21T19:02:59.084Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Python Kullanarak Stres Tespiti</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*3ZByhKrJ7vOLxDvXbBRXQg.png" /></figure><p>Stres, kaygı ve depresyon insanların ruh sağlığını tehdit ediyor. Her insanın stresli bir yaşam sürmek için bir nedeni vardır. İnsanlar genellikle duygularını Instagram gibi sosyal medya platformlarında gönderiler ve hikayeler şeklinde paylaşırlar. Son birkaç yılda, birçok içerik oluşturucu, insanlara akıl sağlığı konusunda yardımcı olacak içerikler oluşturmak için öne çıktı. Birçok kuruluş, hangi sosyal medya kullanıcılarının stres altında olduğunu bulmak ve onlara hızlı bir şekilde yardımcı olmak için stres tespitini kullanmak için çabalıyorlar. Dolayısıyla, sosyal medya gönderilerindeki stresi algılamak için makine öğrenimini nasıl kullanacağınızı öğreneceğiz.</p><p>İnsanların gönderilerinde kullanabilecekleri ve bir kişinin psikolojik stres yaşayıp yaşamadığını gösterebilecek pek çok kelime olduğundan, stres tespiti zorlu bir iştir. Bu çalışma için kullandığım veri seti, ruh sağlığı ile ilgili alt dizinlerde yayınlanan verileri içeriyor. Bu veri seti, insanların hayatları hakkında paylaştığı çeşitli ruh sağlığı sorunlarını içermektedir. Bu veri kümesi 0 ve 1 olarak etiketlenmiştir. 0 stres olmadığını ve 1 stresi olduğunu gösteriyor.</p><p>İlk olarak iligi kütüphaneleri ve dataset imizi yüklemeyle başlayalım.</p><pre>import pandas as pd<br>import numpy as np<br>data = pd.read_csv(&quot;stress.csv&quot;)<br>print(data.head())</pre><pre>       subreddit post_id ... syntax_fk_grade sentiment <br>0 ptsd 8601tu ... 3.253573 -0.002742 <br>1 assistance 8lbrx9 ... 8.828316 0.292857 <br>2 ptsd 9ch1zh ... 7.841667 0.011894 <br>3 relationships 7rorpp ... 4.104027 0.141671 <br>4 survivorsofabuse 9p2gbc ... 7.910952 -0.204167 <br><br>[ 5 satır x 116 sütun]</pre><p>Veri kümesinde herhangi bir boş değer olup olmadığına bir göz atalım</p><pre>print(data.isnull().sum())</pre><pre>subreddit 0 <br>post_id 0 cümle_aralığı <br>0 <br>metin 0 <br>id 0 <br>                           .. <br>lex_dal_avg_pleasantness 0 <br>social_upvote_ratio 0 <br>social_num_comments 0 <br>sözdizimi_fk_grade 0 <br>duygu 0 <br>Uzunluk: 116, dtype: int64</pre><h3>Stres Tespiti Modelleme</h3><p>Bu veri kümesindeki etiket sütunu, 0 ve 1 olarak etiketler içerir. 0, stres olmadığını ve 1, stres anlamına gelir. 1 ve 0 yerine Stress ve No stress etiketlerini kullanalım ve makine öğrenimi modeli eğitme işlemi için metin ve etiket sütunlarını seçelim.</p><pre>data[&quot;label&quot;] = data[&quot;label&quot;].map({0: &quot;No Stress&quot;, 1: &quot;Stress&quot;})<br>data = data[[&quot;text&quot;, &quot;label&quot;]]<br>print(data.head())</pre><pre>                                            text      label<br>0  said felt way sugget go rest trigger ahead you...     Stress<br>1  hey rassist sure right place post goe  im curr...  No Stress<br>2  mom hit newspap shock would know dont like pla...     Stress<br>3  met new boyfriend amaz kind sweet good student...     Stress<br>4  octob domest violenc awar month domest violenc...     Stress</pre><p>Şimdi bu veri setini eğitim ve test setlerine ayıracağım.</p><pre>from sklearn.feature_extraction.text import CountVectorizer<br>from sklearn.model_selection import train_test_split<br><br>x = np.array(data[&quot;text&quot;])<br>y = np.array(data[&quot;label&quot;])<br><br>cv = CountVectorizer()<br>X = cv.fit_transform(x)<br>xtrain, xtest, ytrain, ytest = train_test_split(X, y, <br>                                                test_size=0.33, <br>                                                random_state=42)</pre><p>Bu görev ikili sınıflandırma problemine dayandığından, ikili sınıflandırma problemleri için en iyi algoritmalardan biri olan Bernoulli Naive Bayes algoritmasını kullanacağım.</p><pre>from sklearn.naive_bayes import BernoulliNB<br>model = BernoulliNB()<br>model.fit(xtrain, ytrain)</pre><p>Şimdi modelimizin performansını stres e dayalı bazı rastgele cümleler üzerinde test edelim</p><pre>user = input(&quot;Enter a Text: &quot;)<br>data = cv.transform([user]).toarray()<br>output = model.predict(data)<br>print(output)</pre><pre>Enter a Text: People need to take care of their mental health<br>[&#39;No Stress&#39;]</pre><pre>user = input(&quot;Enter a Text: &quot;)<br>data = cv.transform([user]).toarray()<br>output = model.predict(data)<br>print(output)</pre><pre>Enter a Text: Sometime I feel like I need some help<br>[&#39;Stress&#39;]</pre><p>Gördüğünüz gibi, makine öğrenimi modelimizin sonuçlarının iyi olduğunu görebiliriz. Sosyal medya gönderilerinden kaynaklanan stresi algılamak için bir stres algılama modelini bu şekilde eğitebilirsiniz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d08ecce9203" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>