<?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 Saloni Gupta on Medium]]></title>
        <description><![CDATA[Stories by Saloni Gupta on Medium]]></description>
        <link>https://medium.com/@sg3910?source=rss-865d31934014------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ULnxiMGf77MS1ASG6Tv4Ig.jpeg</url>
            <title>Stories by Saloni Gupta on Medium</title>
            <link>https://medium.com/@sg3910?source=rss-865d31934014------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:22:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sg3910/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[Summary of ‘LLM Agents in Enterprise Workflows’ from LLM Agents MOOC]]></title>
            <link>https://medium.com/@sg3910/summary-of-llm-agents-in-enterprise-workflows-from-llm-agents-mooc-3ccc78a9a7cc?source=rss-865d31934014------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ccc78a9a7cc</guid>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Saloni Gupta]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 04:05:15 GMT</pubDate>
            <atom:updated>2024-12-11T04:05:15.212Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Professor Dawn Song recently launched the <a href="https://llmagents-learning.org/f24">LLM Agents MOOC</a>. As an AI Scientist working on using Agentic AI for enterprise workflows, I found Lecture 7 on ‘LLM Agents in Enteprise Workflows’ particularly insightful. The article summarizes the key learnings.</blockquote><h4>What are LLM Agents?</h4><p>LLM agents are LLM-powered entities able to autonomously plan and take actions to execute goals over multiple iterations. Since LLMs are trained on lots of world background knowledge, they already have an understanding on how to use common types of software used everyday in enterprises (e.g. MS Word, MS PowerPoint, SAP etc.). LLMs thus become a great tool to be leveraged by LLM Agents to automate enterprise workflows.</p><h4>Types of LLM Agents</h4><p>There are broadly two types of LLM Agents — API agents and Web agents.</p><p><strong>API Agents</strong></p><p>API agents have a set of APIs as tools to work with, which primarily exchange textual information with each other.</p><p>In order to build a system using API Agents, we need to use the right agent framework. ServiceNow has released <a href="https://github.com/ServiceNow/TapeAgents"><strong>TapeAgents</strong></a><strong> </strong>— a new holistic framework for agent development and optimization. While frameworks like crewAI, LangGraph address agent development needs, and frameworks like DSPy address data-driven agent optimization needs, TapeAgents offers the ability to do both in one framework.</p><p><strong>Web Agents</strong></p><p>Web agents have the ability to use the web similar to how humans do — filling forms, navigating to pages, etc. However, there are several challenges for web agents that are far from solved, these include — long context understanding, long-term planning, learning and adaptability, multimodality, cost and efficiency, and, safety and alignment.</p><p>To aid further development of web agents, ServiceNow has released two benchmarks <a href="https://arxiv.org/abs/2403.07718"><strong>WorkArena</strong></a><strong> </strong>and<strong> </strong><a href="https://arxiv.org/abs/2407.05291"><strong>WorkArena++</strong></a><strong> — </strong>to study the proficiency of web agents at solving common knowledge work tasks in enterprise settings.</p><h4>Evolution of Automation in Enterprise Workflows</h4><p>The landscape of automation in enterprise workflows in the past couple of years has evolved from manually scripted workflows (e.g. RPA), to classical AI workflows (e.g. recommender systems), to conversational workflows (e.g. RAG) to now <strong>Agentic workflows</strong>, which <strong>require most intelligence but also have the most promise for automation.</strong></p><p><strong>Agents have the opportunity to solve millions of low-value/low-volume tasks</strong>, e.g. sorting email, updating CRM, filling out time-sheets etc.<strong> that RPA is not designed to automate</strong>, because these tasks never occur twice in exactly the same way.</p><h4>Conclusion</h4><p><strong>AI Agents are poised to change the nature of work.</strong> Very soon, most of today’s enterprise workflows will use AI Agents to automate whole or part of the process, even before a human agent is involved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ccc78a9a7cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Techniques to Enhance Graph Data Ingestion with Python in ArangoDB]]></title>
            <link>https://pub.towardsai.net/7-techniques-to-enhance-graph-data-ingestion-with-python-in-arangodb-5ebec50994af?source=rss-865d31934014------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ebec50994af</guid>
            <category><![CDATA[data-ingestion]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[arangodb]]></category>
            <category><![CDATA[speed-optimization]]></category>
            <dc:creator><![CDATA[Saloni Gupta]]></dc:creator>
            <pubDate>Wed, 06 Mar 2024 14:02:09 GMT</pubDate>
            <atom:updated>2024-03-06T14:02:09.797Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fr9z33Z1SRV-lIr0" /><figcaption>Photo by <a href="https://unsplash.com/@alinnnaaaa?utm_source=medium&amp;utm_medium=referral">Alina Grubnyak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>ArangoDB stands out as one of the most versatile graph database solutions available today. My introduction to ArangoDB came during a project transition from Neo4j, where I discovered its unique query language, ArangoDB Query Language (AQL), reminiscent of Cypher for Neo4j. If you’re curious about the comparison between ArangoDB and Neo4j, this detailed resource might interest you:</p><p><a href="https://arangodb.com/solutions/comparisons/arangodb-vs-neo4j/">ArangoDB vs Neo4j - What you can&#39;t do with Neo4j</a></p><p>In the course of this project, I set up a local instance of ArangoDB using docker, and employed the ArangoDB Python Driver, python-arango, to develop data ingestion scripts. The scale of data I dealt with reached millions of nodes and relations, which posed a significant challenge in terms of performance optimization.</p><p>Assuming you’re actively engaged in an ArangoDB graph project, the purpose of this article is to share the optimization strategies I utilized to enhance data ingestion performance, empowering you to implement similar practices. Let’s delve into each optimization:</p><h3><strong>Optimizations Applied for Efficient Data Ingestion<em>:</em></strong></h3><ol><li><strong>Utilising </strong><strong>import_bulk with a batch size</strong> for faster import</li><li><strong>Leveraging Pandas &amp; </strong><strong>import_bulk for Relation Creation</strong> Over AQL Queries</li><li><strong>Harnessing Batch API</strong> for Streamlined Relation Queries</li><li><strong>Enhancing Maximum Memory Map Configuration</strong></li><li><strong>Batch Iteration Through Collections</strong> to Mitigate Timeout and Reconnect Issues</li><li><strong>Increasing Timeout of ArangoDB Client</strong> <strong>and Ttl Value</strong> for Queries to Avoid HTTPS and Cursor Timeout Respectively</li><li><strong>Defining additional indexes</strong></li></ol><p>Let us look at each one in more detail.</p><h4>1. Utilising import_bulk with a batch size for faster import</h4><p>Employing import_bulk with a specified batch size proves to be the most efficient method for inserting multiple documents into a collection. Here’s how you can leverage it :</p><p>a. For vertex collections:</p><pre>vc1 = db.collection(vertex_collection_name)<br>vc1.import_bulk(df_vertex_data, batch_size=50000)</pre><p>b. For edge collections, a similar approach can be adopted. This is elaborated in the subsequent point 2.</p><pre>ec1 = db.collection(edge_collection_name)<br>ec1.import_bulk(df_relation_data, from_prefix=source, to_prefix=target, batch_size=50000)</pre><p>Reference: <a href="https://docs.python-arango.com/en/main/specs.html#arango.collection.Collection.import_bulk">https://docs.python-arango.com/en/main/specs.html#arango.collection.Collection.import_bulk</a></p><h4>2. <strong>Leveraging Pandas &amp; </strong><strong>import_bulk for Relation Creation</strong> Over AQL Queries</h4><p>There are multiple ways to insert relations i.e. edge collection into an ArangoDB graph database. An AQL query could do the job using the ‘INSERT’ operation. While AQL queries serve well for simple operations, complex queries involving multiple joins and conditions might significantly slow down the insertion of edges into the edge collection. In such cases, <strong>employing Pandas for merges, filtering, and transformations, followed by bulk insertion with </strong><strong>import_bulk</strong>explained in 1, <strong>proves to be more efficient</strong>.</p><h4><strong>3. </strong>Harnessing Batch API for Streamlined Relation Queries</h4><p>Opt for <strong>batch API execution</strong> for queries accessing large volumes of data. Methods such as <strong>insert_many(), </strong><strong>update_many(), </strong><strong>replace_many(), and </strong><strong>delete_many()</strong> facilitate inputting multiple documents simultaneously. These methods have replaced the batch request API in newer versions of ArangoDB post 3.8.0.</p><p>Reference: <a href="https://docs.python-arango.com/en/main/batch.html">https://docs.python-arango.com/en/main/batch.html</a></p><h4>4. Enhancing Maximum Memory Map Configuration</h4><p><strong>Increasing </strong><strong>vm.max_memory_map</strong> can significantly enhance performance for memory-intensive operations, such as those characteristic of database operations. Adjustments to this parameter are essential, especially in Docker environments.</p><p>Here&#39;s how you can adjust it in Windows using Powershell:</p><pre>wsl -d docker-desktop<br>sudo sysctl -w &quot;vm.max_map_count=2048000&quot;</pre><p>Note: You may have to tune this parameter based on your requirements. This is the minimum value that I needed for my data volume to be successfully ingested.</p><h4><strong>5. </strong>Batch Iteration Through Collections to Mitigate Timeout and Reconnect Issues</h4><p>When retrieving an entire collection during data ingestion, consider <strong>iterating through the collection in batches</strong>, especially if it’s large. This prevents timeout and reconnect issues. Below is a sample code snippet illustrating this approach.</p><pre>def get_full_collection(db, collection_name, aql):<br>    # get total amount of documents in collection<br>    #entries = db.collection(collection_name).count()  - slow<br>    entries = list(aql.execute(&quot;RETURN LENGTH(&quot;+collection_name+&quot;)&quot;, ttl=1000000))[0]<br>    print(entries)<br>    limit = 50000  # blocksize you want to request<br>    l = []  # final output<br>    for x in range(int(entries / limit) + 1):<br>        block = db.collection(collection_name).all(skip=x * limit, limit=limit)<br>        l.extend(block)<br><br>    return l</pre><h4>6. <strong>Increasing Timeout of ArangoDB Client</strong> <strong>and Ttl Value</strong> for Queries to Avoid HTTPS and Cursor Timeout Respectively</h4><p>Initialize the ArangoDB client with a custom DefaultHTTPClient and set a higher value for request_timeout to accommodate larger datasets. This is how you can do it:</p><pre>from arango.http import DefaultHTTPClient<br># Initialize the ArangoDB client.<br>client = ArangoClient(http_client=DefaultHTTPClient(request_timeout=1000000))</pre><p>Similarly, adjust the ttl (time to live) parameter while executing AQL queries for longer-running queries. An example of how you can increase the value of ttl parameter in aql.execute() is shared below:</p><pre>aql.execute(&quot;RETURN LENGTH(&quot;+collection_name+&quot;)&quot;, ttl=1000000))</pre><h4>7. <strong>Defining additional indexes</strong></h4><p>Don’t overlook the importance of adding indexes to frequently used collections in the data ingestion process. Indexing significantly boosts query performance, thus expediting data ingestion procedures.</p><p>These optimization techniques, consolidated here, aim to enrich your ArangoDB experimentation endeavors.</p><p>Please feel free to share your experiences with these strategies and their impact on your projects!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ebec50994af" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/7-techniques-to-enhance-graph-data-ingestion-with-python-in-arangodb-5ebec50994af">7 Techniques to Enhance Graph Data Ingestion with Python in ArangoDB</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Nodes to Rows: A Guide to Querying Neo4j Graph Database in Pandas/SQL Style Using Cypher]]></title>
            <link>https://medium.com/neo4j/from-nodes-to-rows-a-guide-to-querying-graph-databases-in-pandas-sql-style-using-cypher-fae25be8c1f9?source=rss-865d31934014------2</link>
            <guid isPermaLink="false">https://medium.com/p/fae25be8c1f9</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[cypher]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Saloni Gupta]]></dc:creator>
            <pubDate>Sat, 04 Mar 2023 22:05:23 GMT</pubDate>
            <atom:updated>2023-03-15T18:09:28.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TRR_ZQkHXARqSLk3" /><figcaption>Photo by <a href="https://unsplash.com/@galka_nz">Galina Nelyubova</a> on <a href="https://unsplash.com/photos/Ylj4PO0AgEU">Unsplash</a></figcaption></figure><p>Well, you might be wondering: Why would one want to write Pandas or SQL-style queries while working with a graph database like Neo4j? Does it not defeat the purpose of having data stored and ingested in a graph DB in the first place? No, it doesn’t.</p><p>Graph databases excel at storing and querying complex, connected data that is difficult to represent in a traditional tabular database. However, not all data analysts/scientists who wish to analyze a graph database are fluent in <a href="https://neo4j.com/developer/cypher">Cypher</a>, the query language used by many graph databases.</p><p>They may be more comfortable performing data analysis in SQL or Pandas, and wish to perform tabular-style data analysis on a graph. In such cases, writing SQL or pandas-style queries in Cypher provides a way to leverage the benefits of the graph database while working within a familiar framework.</p><p>Additionally, there may be a need to first perform exploratory data analysis in SQL or pandas before leveraging the graph structure to gain additional insights.</p><p>For instance, suppose you have a graph database with millions of nodes and relationships, and you need to perform data analysis or visualization tasks that require working with tabular data. In that case, you can use pandas-style queries to extract data from the graph database and manipulate it in a way that’s more suitable for your needs.</p><p>This can help you gain a better understanding of the data and uncover patterns or relationships that may not be immediately apparent from a graph structure. Once you have extracted the necessary data, you can use it to make informed decisions about how to interact with the original graph database.</p><p>Therefore, pandas or SQL-style queries in Cypher do not defeat the purpose of using a graph database. Instead, they provide a way to work with graph data in a more flexible and convenient way, without sacrificing the benefits of using a graph database.</p><p>Now, let’s get to the fun part — writing Cypher queries for common analysis operations performed on tabular data. We will be running queries on the sample Northwind Graph provided by Neo4j for exploration purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5eepNegF0haEyCH6hli57Q.png" /><figcaption>Northwind Model</figcaption></figure><p>To load this dataset into Neo4j please follow the instructions here: <a href="https://neo4j.com/graphgists/northwind-recommendation-engine/">https://neo4j.com/graphgists/northwind-recommendation-engine/</a>.</p><p>To run the pandas code, I used the dataset available here: <a href="https://github.com/graphql-compose/graphql-compose-examples/tree/master/examples/northwind/data/csv">https://github.com/graphql-compose/graphql-compose-examples/tree/master/examples/northwind/data/csv</a>.</p><p>[Note by Publication] There is a dedicated graph example dataset for Northwind available here:</p><p><a href="https://github.com/neo4j-graph-examples/northwind/">GitHub - neo4j-graph-examples/northwind: From RDBMS to Graph, using a classic dataset</a></p><ol><li><strong>Getting value counts of a list of values:</strong></li></ol><p>Sample Question: <em>List the counts of the unique list of product categories provided by each supplier.</em></p><p>Pandas equivalent code:</p><pre># read the data from the CSV files<br>categories = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/categories.csv&#39;)<br>products = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/products.csv&#39;)<br>suppliers = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/suppliers.csv&#39;)<br><br># merge the dataframes on the necessary columns<br>merged = pd.merge(pd.merge(products, categories, on=&#39;categoryID&#39;), suppliers, on=&#39;supplierID&#39;)<br><br># group by supplier and category and count the occurrences<br>merged_groupby = merged.groupby([&#39;companyName&#39;])[&#39;categoryName&#39;].unique().reset_index()<br><br># display the results<br>print(merged_groupby[&#39;categoryName&#39;].value_counts())</pre><p>SQL equivalent query (if data was stored in a relational DB):</p><pre>SELECT array_agg(DISTINCT c.categoryName) AS Categories, COUNT(*) AS value_counts<br>FROM supplier s<br>JOIN product p ON s.supplierID = p.supplierID<br>JOIN category c ON p.categoryID = c.categoryID<br>GROUP BY s.companyName<br>ORDER BY value_counts DESC;</pre><p>Cypher query:</p><pre>MATCH (s:Supplier)--&gt;(:Product)--&gt;(c:Category)<br>WITH s.companyName as Company, collect(distinct c.categoryName) as Categories<br>RETURN Categories, COUNT(*) AS value_counts<br>ORDER BY value_counts DESC</pre><p>If we just wanted the categories as a list (this query is already given in part 4/7 of the playbook), the query would be:</p><pre>MATCH (s:Supplier)--&gt;(:Product)--&gt;(c:Category)<br>RETURN s.companyName as Company, collect(distinct c.categoryName) as Categories</pre><p>However, to get the value counts of an array, the simple trick is to first write a query to return the array, and then change the RETURN to WITH. Then add a return statement to treat this array as a single entity and just do a COUNT(*). Also, notice how we can <em>easily perform multiple joins in just one</em> MATCH line in Cypher.</p><p>Cypher output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0W1upBbTjjIbRGuZ-7TOdg.png" /><figcaption>Snippet of Neo4j Output from Cypher query to <em>List the value counts of unique product categories provided by each supplier</em></figcaption></figure><p><strong>2. Joining, grouping, and aggregating data:</strong></p><p>Sample Question: <em>Which customers have made orders with a total cost greater than $1000?</em></p><p>Pandas equivalent code:</p><pre># read the data into pandas dataframes<br>products = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/products.csv&#39;)<br>order_details = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/order_details.csv&#39;)<br>orders = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/orders.csv&#39;)<br>customers = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/customers.csv&#39;)<br><br># merge the dataframes on common columns<br>merged_data = pd.merge(pd.merge(order_details, orders, on=&#39;orderID&#39;), products, on=&#39;productID&#39;)<br>merged_data = pd.merge(customers, merged_data, on=&#39;customerID&#39;)<br><br># calculate the total cost for each order<br>merged_data[&#39;totalCost&#39;] = merged_data[&#39;unitPrice_x&#39;] * merged_data[&#39;unitsOnOrder&#39;]<br><br># group the data by customer and sum the total cost<br>customer_order_totals = merged_data.groupby([&#39;customerID&#39;,&#39;companyName&#39;]).agg({&#39;totalCost&#39;: &#39;sum&#39;})<br><br># filter for customers with total cost greater than $1000<br>high_spending_customers = customer_order_totals[customer_order_totals[&#39;totalCost&#39;] &gt; 1000]<br><br># print the list of high spending customers<br>print(high_spending_customers)</pre><p>SQL equivalent query (if data was stored in a relational DB):</p><pre>SELECT CustomerID, CompanyName, TotalCost<br>FROM (<br>  SELECT c.CustomerID AS CustomerID, c.CompanyName AS CompanyName, SUM(p.UnitPrice * p.UnitsOnOrder) AS TotalCost<br>  FROM Customers c<br>  JOIN Orders o ON c.CustomerID = o.CustomerID<br>  JOIN `Order Details` od ON o.OrderID = od.OrderID<br>  JOIN Products p ON od.ProductID = p.ProductID<br>  GROUP BY c.CustomerID, c.CompanyName<br>  HAVING TotalCost &gt; 1000<br>) t;</pre><p>Cypher query:</p><pre>MATCH (c:Customer)-[:PURCHASED]-&gt;(o:Order)-[:ORDERS]-&gt;(p:Product)<br>WITH c, SUM(p.unitPrice * p.unitsOnOrder) AS TotalCost<br>WHERE TotalCost &gt; 1000<br>RETURN c.customerID AS CustomerID, c.companyName AS CompanyName, TotalCost</pre><p>Again, notice how we can easily perform multiple joins in just one MATCH line in Cypher.</p><p>In this query, we first connect the data belonging to all the relevant nodes, i.e., products, categories, orders, and customers. Then, we group the data by category and calculate the total revenue generated by summing up the product of the quantity and unit price for each order.</p><p>Cypher output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lr6OXdLzEW6Zl48ReCgkoA.png" /><figcaption>Snippet of Neo4j Output from Cypher query <em>to get a list of customers who have made orders with a total cost &gt; $1000</em></figcaption></figure><p><strong>3. Filtering using negation of subquery:</strong></p><p>Sample Question: <em>What are the product names of all products that have not been ordered by customers from Germany?</em></p><p>Pandas equivalent code:</p><pre># read the data from the CSV files<br>orders = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/orders.csv&#39;)<br>customers = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/customers.csv&#39;)<br>products = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/products.csv&#39;)<br>order_details = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/order_details.csv&#39;)<br><br># merge the dataframes on the necessary columns<br>merged = pd.merge(pd.merge(pd.merge(products, order_details, on=&#39;productID&#39;), orders, on=&#39;orderID&#39;), customers, on=&#39;customerID&#39;)<br><br># find the product names not ordered by customers from Germany<br>not_ordered_by_germany = merged[merged[&#39;country&#39;] != &#39;Germany&#39;][&#39;productName&#39;].unique()<br><br># filter the products dataframe to get the product names<br>result = products[products[&#39;productName&#39;].isin(not_ordered_by_germany)][&#39;productName&#39;]<br><br># display the results<br>print(result)</pre><p>SQL equivalent query (if data was stored in a relational DB):</p><pre>SELECT productName<br>FROM Product<br>WHERE productName NOT IN (<br>  SELECT p.productName<br>  FROM Product p<br>  JOIN Orders o ON p.productId = o.productId<br>  JOIN Customer c ON o.customerId = c.customerId<br>  WHERE c.Country = &#39;Germany&#39;<br>)</pre><p>Cypher query:</p><p>Version 1: Subquery style using CALL and WHERE NOT {}</p><pre>CALL {<br>  MATCH (p:Product)<br>  WHERE (p)&lt;-[:ORDERS]-(:Order)&lt;-[:PURCHASED]-&gt;(:Customer {Country: &#39;Germany&#39;})<br>  RETURN collect(p.productName) AS productName_list<br>}<br>MATCH (p:Product)<br>WHERE NOT p.productName IN productName_list<br>RETURN p.productName AS ProductName</pre><p>Version 2: Concise without CALL {} subquery.</p><pre>MATCH (p:Product)<br>WHERE NOT exists {(p)&lt;-[:ORDERS]-(:Order)&lt;-[:PURCHASED]-&gt;(:Customer {Country: &#39;Germany&#39;}) }<br>RETURN p.productName  AS ProductName</pre><p>Again, notice how we can easily perform multiple joins in just one MATCH”line in Cypher. Furthermore, we can see that using CALL{} to write a subquery-style query in Cypher while being a valid option, is not necessary. It may be possible to make the query even more concise without an explicit subquery.</p><p>Cypher output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/0*Ccor7VPRNdIGUOLd.png" /><figcaption>Snippet of Neo4j Output from Cypher query <em>to get a list of product names of products that have not been ordered from Germany</em></figcaption></figure><p><strong>4. Concatenating data (vertically):</strong></p><p>Sample Question: <em>List all customers and suppliers in one combined list with their respective names and types of entity.</em></p><p>Pandas equivalent code:</p><pre># Define data for Customers<br>customers = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/customers.csv&#39;)<br><br>customers[&#39;type&#39;] = &#39;Customer&#39;<br>customers = customers.rename(columns={&#39;customerID&#39;: &#39;id&#39;, &#39;companyName&#39;: &#39;name&#39;})<br>customers = customers[[&#39;id&#39;, &#39;name&#39;, &#39;type&#39;]]<br><br># Define data for Suppliers<br>suppliers = customers = pd.read_csv(&#39;https://raw.githubusercontent.com/graphql-compose/graphql-compose-examples/master/examples/northwind/data/csv/suppliers.csv&#39;)<br><br>suppliers[&#39;type&#39;] = &#39;Supplier&#39;<br>suppliers = suppliers.rename(columns={&#39;supplierID&#39;: &#39;id&#39;, &#39;companyName&#39;: &#39;name&#39;})<br>suppliers = suppliers[[&#39;id&#39;, &#39;name&#39;, &#39;type&#39;]]<br><br># Concatenate data<br>result = pd.concat([customers, suppliers], ignore_index=True)<br><br># display the results<br>print(result)</pre><p>SQL equivalent query (if data was stored in a relational DB):</p><pre>SELECT customerID AS id, companyName AS name, &#39;Customer&#39; AS type<br>FROM Customers<br>UNION ALL<br>SELECT supplierID AS id, companyName AS name, &#39;Supplier&#39; AS type<br>FROM Suppliers;</pre><p>Cypher query:</p><pre>MATCH (c:Customer)<br>RETURN c.customerID AS id, c.companyName AS name, &#39;Customer&#39; AS type<br>UNION ALL<br>MATCH (s:Supplier)<br>RETURN s.supplierID AS id, s.companyName AS name, &#39;Supplier&#39; AS type</pre><p>In this case, both the SQL and Cypher queries are very similar with only minor syntax differences. However, the Pandas version is a bit more verbose.</p><p>Cypher output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HX7q7dUnDBa1AU_gB8Yohw.png" /><figcaption>Snippet of Neo4j Output from Cypher query <em>to get a combined </em>list of all customers and suppliers with their respective names and types of entity</figcaption></figure><p><strong>Takeaways:</strong></p><p>We can perform the same data analysis that we do using Pandas or SQL , using Cypher queries as well, if the data is loaded into Neo4j in the right way. It is not necessary that Cypher queries are always simpler than their equivalent Pandas code or SQL queries, but many times, they indeed might be.</p><p>This is because of the following advantages of querying using Cypher:</p><ol><li>Easier joins: Connecting data is generally easier in Cypher as compared to SQL because Cypher is specifically designed for querying graph patterns and focuses on the relationships between nodes rather than just the properties of nodes. <br>In Cypher, we can traverse the graph and follow relationships to join different nodes together, which is a more natural and intuitive way of joining data when working with graphs. On the other hand, in SQL, joining data involves a lot of complex syntaxes and can be challenging to understand.</li><li>Flexible pattern matching: Another advantage of Cypher is that it allows for easier pattern matching. You can use the MATCH clause to specify the nodes and relationships you’re interested in, and then use the WHERE clause to filter the results. <br>This can be more flexible than SQL, which requires you to specify the exact columns and tables you want to query. With Cypher, you can focus on the patterns in the data and write queries that capture them more easily.</li></ol><p>However, it is important to keep in mind that using a graph DB like Neo4j to store and query your data might not be the best choice in all scenarios, especially when data is more structured and less interconnected relationships.</p><p><strong><em>But, if your data has complex relationships, and you need to perform complex queries, scale your analysis, or want greater flexibility in your data modeling, then, a graph database like Neo4j would likely be a better choice than a relational database.</em></strong></p><p>Writing queries in Cypher might be uncomfortable to begin with, but practicing regularly will make you confident in your Cypher data analysis skills in no time. <a href="https://graphacademy.neo4j.com/">GraphAcademy</a> courses are a great place to learn Neo4j, with their amazing hands-on in-built exercises. <br>I personally used these a lot on my Cypher learning journey.</p><figure><a href="https://graphacademy.neo4j.com/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7FknpDkvPvOqmSGnfxmfNQ.png" /></a><figcaption>Neo4j GraphAcademy Courses</figcaption></figure><p>Thank you for reading my article. If you liked this article, and wish to see more such content, please show some support by <strong>following me on Medium</strong>.</p><p>If you would like more specific content on Neo4j or any other graph DB, please comment below with details. Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fae25be8c1f9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/from-nodes-to-rows-a-guide-to-querying-graph-databases-in-pandas-sql-style-using-cypher-fae25be8c1f9">From Nodes to Rows: A Guide to Querying Neo4j Graph Database in Pandas/SQL Style Using Cypher</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing the Right Text Annotation Tool: Decision-Making Guide]]></title>
            <link>https://medium.com/nlplanet/choosing-the-right-text-annotation-tool-decision-making-guide-65931e92f7ea?source=rss-865d31934014------2</link>
            <guid isPermaLink="false">https://medium.com/p/65931e92f7ea</guid>
            <category><![CDATA[text-annotation]]></category>
            <category><![CDATA[named-entity-recognition]]></category>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[annotation-tools]]></category>
            <dc:creator><![CDATA[Saloni Gupta]]></dc:creator>
            <pubDate>Fri, 03 Mar 2023 05:12:19 GMT</pubDate>
            <atom:updated>2023-03-07T13:21:20.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JfKIQARGEaex7EodsyazA.jpeg" /><figcaption><em>Image from </em><a href="https://unsplash.com/photos/gGsXfIql7BY">https://unsplash.com/photos/gGsXfIql7BY</a></figcaption></figure><blockquote>Text annotation is a crucial task in many industries, such as natural language processing, machine learning, and linguistics. However, with the plethora of text annotation tools available in the market, it can be overwhelming to choose the right one. In this article, we provide an overview of open source and enterprise-grade text annotation tools and the factors that should be considered when choosing between them. For individuals working in data science who are new to text annotation, this guide aims to provide a comprehensive understanding of the landscape and help them make informed decisions based on their project requirements.</blockquote><p>Text annotation is the process of labeling and categorizing textual data to make it machine-readable. It is a critical step in many machine learning tasks, such as sentiment analysis, named entity recognition, and information extraction. The process of text annotation involves identifying and labeling different components of a text, such as keywords, entities, and sentiments, in a consistent and standardized way. This makes it easier for machine learning models to learn from the data and make accurate predictions. For example, in sentiment analysis, text annotation is used to label text as positive, negative, or neutral, which can be used to train a machine learning model to predict the sentiment of new text.</p><p>To understand the different considerations needed to select the best text annotation tool for a particular use case, let us consider an example scenario — we need to perform text annotation to generate an annotated dataset for input into a custom named entity recognition (NER) model. Let us assume the NER model is BERT-based and requires BIO format for the input dataset. These are two broad ways in which we can perform text annotation:</p><p><strong>1. Manual annotation </strong>— Use a simple text annotation tool go line by line and highlight and tag each word separately and assign it a label.</p><p><strong>Pros:</strong></p><p>· Usually free to use</p><p>· No learning curve</p><p><strong>Cons:</strong></p><p>· Time-consuming and labor-intensive process</p><p>· Prone to errors and inconsistencies due to human error, subjective interpretations and personal biases</p><p>· Not usually suitable for teams of 3 or more people</p><p><strong>2. Smart annotation</strong> — Use text annotation tools with more capabilities such as annotating using patterns or regex and/or advanced features such as human-in-the-loop labeling, ML-assisted labeling, collaboration features etc.</p><p><strong>Pros:</strong></p><p>· Can largely automate the annotation process, increase efficiency, and reduce errors and inconsistencies.</p><p>· For large volumes of input data, significantly faster</p><p>· Most of the tools can also provide standardized annotation guidelines and facilitate collaboration among multiple annotators</p><p><strong>Cons:</strong></p><p>· Expensive</p><p>· Paid tools require a minimum commitment time (ranging from a month to a year)</p><p>· Some tools may have a learning curve, and training annotators to use them effectively can be time-consuming</p><p>As we can see, text annotation tools can vary a lot in what they offer. Therefore, selecting the right tool for a specific use case can be challenging and requires a thorough understanding of requirements and some research . My journey of finding the best text annotation tool for my use case spanned over three weeks, where I tried and tested various text annotation tools available. I was actively engaged in multiple meetings with the Sales and Technical teams of these companies. This enabled me to gain an in-depth understanding of the capabilities and limitations of their products. During this process, I found the following criteria to be helpful in evaluating these tools:</p><ol><li><strong>Pricing model</strong></li></ol><p>Free or paid: Does the tool have an open source version?</p><p>Subscription model: Does the tool offer monthly subscription or do I need to commit to an annual subscription?</p><p>Free trial availability: Do I get to try out the product, preferably for at least a week, to see if it really fits my needs?</p><p><strong>2. Input data types supported</strong></p><p>Text-based: Are only text files supported? Is there PDF annotation support (OCR and text)?</p><p>Image-based: Are other input data types like image, video etc. also supported?</p><p><strong>3. Output formats supported</strong></p><p>Does the tool directly produce annotations in BIO format (used by BERT bases models), spaCy compatible format, CoNLL format etc.? (Note that for programmers, this is a minor consideration since writing functions for output format conversion is always an option)</p><p><strong>4. Ease of Use</strong></p><p>How good is the UI/UX? Is it smooth to navigate? Does it require too many clicks and tab switches?</p><p><strong>5. Smart annotation features supported</strong></p><p>· Is there support for active learning of annotations?</p><p>· Is there support for human-in-the-loop retraining?</p><p>· Is there support for overlapping annotations? For example, ‘Saloni Gupta’ is a Name, but ‘Saloni’ is a First Name, so one word ‘Saloni’ is a part of two labels — Name and First Name.</p><p>· Is there support for hierarchical and/or multi-class labeling?</p><p><strong>6. Collaboration support</strong></p><p>· Is there support for project management, and assigning different roles (like annotator, reviewer, admin etc.) to users?</p><p>· Are there analytics dashboards or statistics available to review workforce progress?</p><p><strong>7. Security model</strong></p><p>Does it support on-premise and hybrid installations, apart from cloud?</p><p><strong>8. Support model</strong></p><p>In what ways can we seek help — is it a slack channel, or email support or even phone support? Is the turnaround from the support team reasonable? Depending on the use case, sometimes a short turnaround time of less than 24 hrs might be preferred, for others, even 2–3 days works fine.</p><p>Based on these criteria, I compared and contrasted various text annotation tools — both open source and paid. <strong>For open source tools, I found Tagtog to be the best choice among free tools.</strong> The other options like UBIAI, Label Studio, Doccano etc. had bugs with UI/UX, which made annotation an overall painful process. I tested out LightTag and Diffgram as well but had two challenges — one was setting things up and/or getting timely email support, second was they both don’t offer PDF annotation support, which I believe is a part of text annotation. Diffgram was particularly not optimized for text annotation.</p><p>For the paid tools, I found many great tools with extensive features. I have summarized my findings in the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BsmnChVJYozBS2UWkvB-1Q.png" /><figcaption>Comparison of text annotation tools (paid)</figcaption></figure><p>My verdict — <strong>Datasaur is hands-down the perfect tool for text annotation purposes</strong>. Kili Technology is a close second, only lacking a bit in cleanliness of UI. Snorkel Flow the best all-rounder amazing product for all input data types (not just text), but a bit too expensive for use cases with smaller data volumes. Depending on which features matter to you most,<strong> in the cheaper tools, either Tagtog or Prodigy would serve your annotation needs well</strong>.</p><p>Hope you all found this article useful. Please comment below if you would like me to write in depth about any of these tools and my experiences in using them for text annotation. Cheers!</p><p><strong>References:</strong></p><ol><li><a href="https://prodi.gy/">https://prodi.gy/</a></li><li><a href="https://kili-technology.com/">https://kili-technology.com/</a></li><li><a href="https://www.tagtog.com/">https://www.tagtog.com/</a></li><li><a href="https://www.superannotate.com/annotation-tool">https://www.superannotate.com/annotation-tool</a></li><li><a href="https://labelbox.com/product/annotate/">https://labelbox.com/product/annotate/</a></li><li><a href="https://labelstud.io/">https://labelstud.io/</a></li><li><a href="https://ubiai.tools/">https://ubiai.tools/</a></li><li><a href="https://snorkel.ai/snorkel-flow-platform/">https://snorkel.ai/snorkel-flow-platform/</a></li><li><a href="https://datasaur.ai/">https://datasaur.ai/</a></li><li><a href="https://www.lighttag.io/">https://www.lighttag.io/</a></li><li><a href="https://diffgram.com/main/">https://diffgram.com/main/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65931e92f7ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nlplanet/choosing-the-right-text-annotation-tool-decision-making-guide-65931e92f7ea">Choosing the Right Text Annotation Tool: Decision-Making Guide</a> was originally published in <a href="https://medium.com/nlplanet">Generative AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>