0Pricing
Neo4j Graph Database Fundamentals · Lekcja

Potoki GDS i uczenie maszynowe

Dowiedz się, jak tworzyć i zarządzać potokami analizy danych grafowych w GDS oraz integrować je z procesami uczenia maszynowego.

Potoki GDS i uczenie maszynowe to bezpłatna lekcja Neo4j Graph Database Fundamentals na CoddyKit. To lekcja 3 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Neo4j Graph Database Fundamentals, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Neo4j Graph Database Fundamentals zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

What are GDS Pipelines?

Welcome to GDS Pipelines! In the Neo4j Graph Data Science (GDS) library, a pipeline is a structured workflow for common graph data science tasks.

Think of it as a blueprint that defines a sequence of steps, from feature engineering using graph algorithms to training and deploying machine learning models.

Why Use GDS Pipelines?

GDS Pipelines offer several key benefits:

  • Reproducibility: Define your entire workflow once and reuse it.
  • Automation: Streamline complex tasks involving multiple graph algorithms and ML steps.
  • Operationalization: Easily deploy graph-based machine learning models for continuous prediction.

They help bridge the gap between experimentation and production.

Creating a Prediction Pipeline

One common pipeline type is the Node Property Prediction Pipeline. This helps predict a specific property on nodes based on other node features and graph structure.

Let's create an empty pipeline named 'myChurnPrediction':

CALL gds.pipeline.nodePropertyPrediction.create('myChurnPrediction')
YIELD pipeline
RETURN pipeline.name AS name, pipeline.type AS type

Projecting Your Graph Data

Before using a pipeline, you need to project your graph into GDS memory. This makes nodes and relationships accessible for algorithms and features.

Here, we project a simple 'User' graph with 'KNOWS' relationships:

CALL gds.graph.project(
    'mySocialGraph',
    'User',
    { KNOWS: { orientation: 'UNDIRECTED' } }
)
YIELD graphName, nodeCount, relationshipCount
RETURN graphName, nodeCount, relationshipCount

Adding Node Property Features

Pipelines allow you to specify which existing node properties should be used as features for your machine learning model. These are direct attributes of your nodes.

Let's add 'age' and 'income' properties as features to our pipeline:

CALL gds.pipeline.nodePropertyPrediction.addNodePropertySteps('myChurnPrediction', {
    nodeProperties: ['age', 'income']
})
YIELD pipeline
RETURN pipeline.name, pipeline.nodePropertySteps

Integrating Graph Algorithm Features

The real power of GDS pipelines is integrating graph algorithm results as features. These capture structural insights that simple node properties can't.

We can add PageRank scores as a feature to our pipeline:

CALL gds.pipeline.nodePropertyPrediction.addPageRank('myChurnPrediction', {
    maxIterations: 10,
    dampingFactor: 0.85,
    mutateProperty: 'pageRankScore' // This becomes a feature
})
YIELD pipeline
RETURN pipeline.name, pipeline.pageRankSteps

Configuring the Machine Learning Model

After defining your features, you specify the machine learning model that will perform the prediction. GDS supports various models like Logistic Regression, Random Forest, and GNNs.

Let's add a Logistic Regression model to predict 'isChurned':

CALL gds.pipeline.nodePropertyPrediction.addLogisticRegression('myChurnPrediction', {
    targetProperty: 'isChurned', // The node property we want to predict
    maxIterations: 100,
    penalty: 'l2'
})
YIELD pipeline
RETURN pipeline.name, pipeline.logisticRegressionSteps

Training Your GDS Pipeline

With features and a model defined, you can now train the pipeline. This executes all feature generation steps, then trains the specified ML model on the generated features.

We'll train our pipeline on 'mySocialGraph' and name the resulting model 'churnPredictionModel':

CALL gds.pipeline.nodePropertyPrediction.train('myChurnPrediction', {
    modelName: 'churnPredictionModel',
    graphName: 'mySocialGraph',
    nodeLabels: ['User'],
    randomSeed: 42
})
YIELD modelInfo
RETURN modelInfo.modelName AS modelName, modelInfo.trainingMetrics.f1Score.weighted AS f1Score

Making Predictions with the Model

Once trained, your model (which is part of the pipeline) can be used to generate predictions on your graph data. You can either stream results or mutate the graph with new properties.

Let's stream predictions for our 'churnPredictionModel':

CALL gds.pipeline.nodePropertyPrediction.predict.stream('churnPredictionModel', {
    graphName: 'mySocialGraph',
    nodeLabels: ['User'],
    topN: 1 // Get the top predicted class
})
YIELD nodeId, predictedProperty, probability
RETURN gds.util.asNode(nodeId).name AS user, predictedProperty, probability
LIMIT 5

Managing Your Pipelines

You can list all active pipelines and their configurations using gds.pipeline.list(). When a pipeline is no longer needed, you can remove it with gds.pipeline.drop().

Let's see the pipelines we currently have:

CALL gds.pipeline.list()
YIELD name, type, creationTime
RETURN name, type, creationTime

GDS Pipeline Components

A GDS pipeline combines various steps to create a complete data science workflow. Which of the following are valid components or steps you can add to a GDS Node Property Prediction Pipeline?

Recap: Pipelines for ML

Great job! You've learned how GDS Pipelines provide a structured and reproducible way to integrate graph algorithms with machine learning workflows.

  • Pipelines define a sequence of steps.
  • They combine feature engineering (from existing properties and graph algorithms) with ML model training.
  • They enable efficient prediction and operationalization of graph-based insights.

Keep exploring GDS to unlock more advanced graph analytics!

Często zadawane pytania

Czy lekcja „Potoki GDS i uczenie maszynowe” jest bezpłatna?

Tak — pełny tekst „Potoki GDS i uczenie maszynowe” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Neo4j Graph Database Fundamentals, przejdź na CoddyKit PRO. Kurs Neo4j Graph Database Fundamentals zawiera 4 lekcji w sumie.

Co nauczysz się w „Potoki GDS i uczenie maszynowe”?

Dowiedz się, jak tworzyć i zarządzać potokami analizy danych grafowych w GDS oraz integrować je z procesami uczenia maszynowego. Ćwiczysz Neo4j Graph Database Fundamentals z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Neo4j Graph Database Fundamentals?

Nie wymagamy żadnego doświadczenia. Neo4j Graph Database Fundamentals w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 3 z 4.

Ile czasu zajmuje lekcja „Potoki GDS i uczenie maszynowe”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Neo4j Graph Database Fundamentals?

Tak. Każda lekcja Neo4j Graph Database Fundamentals zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Wprowadzenie do biblioteki GDS
  2. Uruchamianie algorytmów GDS
  3. Potoki GDS i uczenie maszynowe
  4. Osadzania grafowe z GDS
← Powrót do Neo4j Graph Database Fundamentals