### Apache Spark Quick Start and Setup Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/common/oci_logging This section provides a quick start guide and setup instructions for Apache Spark integration. It covers the initial steps required to get Spark running, including installation and basic configuration within the ADS environment. Assumes necessary prerequisites like Java and Scala are met. ```shell # Example of setting up Spark environment variables (conceptual) # export SPARK_HOME=/path/to/spark # export PATH=$SPARK_HOME/bin:$PATH # # # Download Spark (if not already installed) # # wget https://archive.apache.org/dist/spark/spark-3.X.X/spark-3.X.X-bin-hadoop3.tgz # # tar xvf spark-3.X.X-bin-hadoop3.tgz # # mv spark-3.X.X-bin-hadoop3 /path/to/spark # # # Verify Spark installation # spark-shell --version # spark-submit --version ``` -------------------------------- ### Apache Spark Quick Start and Setup (Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/feature_engineering/feature_type/object Provides a quick start guide and setup instructions for using Apache Spark within the ADS environment. This section covers the initial steps required to get Spark running, including configuration and integration points. The examples are likely in Python, leveraging PySpark. Dependencies include Apache Spark and potentially PySpark. ```python # Placeholder for Apache Spark quick start and setup # This typically involves initializing a SparkSession. from pyspark.sql import SparkSession spark = SparkSession.builder \ .appName("ADS Spark Example") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() spark.stop() ``` -------------------------------- ### Apache Spark Quick Start and Setup Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/yaml_schema Provides a quick start guide and setup instructions for integrating with Apache Spark. This includes necessary configurations and installation steps for running Spark applications on OCI Data Flow. ```python # Example of setting up Spark configuration (often done via spark-defaults.conf or programmatically) from pyspark.sql import SparkSession # To run Spark applications on OCI Data Flow, you typically configure Spark properties. # This might involve setting executor memory, cores, etc. # For interactive Spark sessions, you might start a SparkSession like this: # spark = SparkSession.builder \ # .appName("MySparkApp") \ # .config("spark.some.config.option", "some-value") \ # .getOrCreate() # For Data Flow, the configuration is often managed through the service itself. print("Refer to OCI Data Flow documentation for specific Spark setup and configuration details.") ``` -------------------------------- ### Python: Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/data_catalog_metastore/index Provides a basic example for getting started with Apache Spark integration within ADS. This covers initial setup and a simple Spark operation. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) # Show the DataFrame df.show() # Stop the SparkSession spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/dask/dashboard A quick start guide for using Apache Spark with ADS. This section provides the essential steps to get started with Spark, including setup, configuration, and running basic Spark applications on OCI Data Flow. ```bash # This is a conceptual outline. Actual commands depend on OCI setup. # 1. Ensure you have an OCI Data Flow application created. # 2. Configure your local environment to interact with OCI Data Flow (e.g., using OCI CLI and SDK). # Example: Submitting a Spark application using the OCI CLI # oci data-flow application create \ # --compartment-id \ # --display-name "MySparkApp" \ # --file-uri "oci://your-bucket@your-namespace/path/to/your/spark_app.py" \ # --language "PYTHON" \ # --num-executors 3 \ # --executor-memory-in-gb 8 \ # --driver-shape "OC1" \ # --executor-shape "OC1" # Example: Running a Spark application using ADS SDK (conceptual) # from ads.jobs import Job, SparkJob, Compute # # compute = Compute(shape='OC1', ocpus=1, memory='8Gi', num_executors=3) # spark_job = SparkJob(file='oci://your-bucket@your-namespace/path/to/your/spark_app.py') # # job = Job(name='my-spark-job', workload=spark_job, compute=compute) # job.create() print("Conceptual Apache Spark Quick Start. Refer to OCI Data Flow and ADS documentation for detailed steps.") ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/jobs/builders/runtimes/artifact Provides a quick start guide and setup instructions for using Apache Spark with ADS. This enables large-scale data processing using Spark's distributed computing capabilities. Ensure Spark is installed and configured, and that you have the necessary OCI Data Flow or similar environment set up. The example shows basic Spark RDD operations. ```python from pyspark.sql import SparkSession # Initialize Spark Session # In a managed environment like OCI Data Flow, SparkSession is often pre-configured. # For local setup, you might need to specify master URL. spark = SparkSession.builder \ .appName("ADSSparkQuickStart") \ .getOrCreate() print(f"SparkSession created. Spark version: {spark.version}") # --- Example 1: Creating a Spark DataFrame from a list --- data = [("Alice", 1), ("Bob", 2), ("Charlie", 3)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # --- Example 2: Reading data from a file (e.g., CSV) --- # Assume 'data.csv' exists in a location accessible by Spark try: df_from_csv = spark.read.csv("data.csv", header=True, inferSchema=True) df_from_csv.show() except Exception as e: print(f"Could not read data.csv: {e}") print("Ensure 'data.csv' is accessible or replace with a valid path.") # --- Example 3: Performing a simple Spark operation --- # Count the number of rows in the DataFrame row_count = df.count() print(f"Number of rows in DataFrame: {row_count}") # Filter data filtered_df = df.filter(df.id > 1) filtered_df.show() # Stop the SparkSession when done spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/feature_engineering/adsimage/image Guides users through the quick start and setup process for Apache Spark integration within the ADS environment. This enables large-scale data processing. Requires Spark and ADS installation. ```python from pyspark.sql import SparkSession # Initialize Spark Session # For local execution, SparkSession.builder.getOrCreate() is usually sufficient. # For OCI Data Flow, the Spark session is often pre-configured. spark = SparkSession.builder.appName("ADSSparkQuickStart").getOrCreate() print("Spark Session created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Stop the Spark Session when done # spark.stop() print("Apache Spark quick start example executed.") ``` -------------------------------- ### Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/loading_data/supported_format Provides a basic example of how to get started with Apache Spark integration within ADS. This typically involves setting up a Spark session. Assumes Spark and necessary connectors are installed. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Apache Spark Quick Start (Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/horovod/creating Provides a basic example of how to get started with Apache Spark on OCI Data Flow using the ADS library. This covers initial setup and running a simple Spark application. Requires OCI SDK and Spark environment configured. ```python # Example: Initializing SparkSession within an OCI Data Flow context # from pyspark.sql import SparkSession # spark = SparkSession.builder.appName("ADSSparkQuickStart").getOrCreate() # # Your Spark code here # data = [("Alice", 1), ("Bob", 2)] # columns = ["name", "id"] # df = spark.createDataFrame(data, columns) # df.show() # spark.stop() ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/modules Provides a quick start guide and setup instructions for Apache Spark integration within the ADS environment. This snippet covers the initial steps required to use Spark with ADS, including potential configuration and installation details. ```python # Example: Initializing SparkSession using PySpark within ADS # This typically requires Spark to be installed and configured in the environment try: from pyspark.sql import SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quickstart") \ .getOrCreate() print("SparkSession created successfully.") print(f"Spark version: {spark.version}") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession when done spark.stop() except ImportError: print("PySpark is not installed or configured in this environment.") except Exception as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Quick Start for Apache Spark Integration Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/database/connection A concise guide to getting started with Apache Spark integration within ADS. This covers initial setup and basic usage patterns. ```python # Example: Initializing Spark session within ADS context from ads.spark import SparkSession spark = SparkSession.builder.appName("MySparkApp").getOrCreate() print(spark.version) # Further Spark operations... ``` -------------------------------- ### Apache Spark Quick Start in ADS Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/quick_start/quick_start This example provides a quick start guide for using Apache Spark with the Accelerated Data Science (ADS) library. It covers basic setup and common operations for Spark within the ADS environment. Dependencies include Apache Spark and the ADS package. ```python from pyspark.sql import SparkSession # Example of creating a SparkSessionspark = SparkSession.builder.appName("ADSSparkQuickstart").getOrCreate() # Perform Spark operations here ``` -------------------------------- ### Python: Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/model_evaluation/quick_start Provides a basic example of how to get started with Apache Spark within the ADS environment. This typically involves initializing a Spark session and performing a simple operation. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Create a simple DataFrame data = [("Alice", 1), ("Bob", 2), ("Charlie", 3)] columns = ["Name", "ID"] df = spark.createDataFrame(data, columns) # Show the DataFrame df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/common/data Provides guidance on getting started with Apache Spark, including setup and installation instructions. This section likely covers how to configure Spark environments, potentially for use within OCI Data Science or local development. The focus is on enabling users to run Spark applications efficiently. ```python # Assuming Spark is installed and configured in the environment (e.g., via Conda) # Example of initializing a SparkSession from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Example: Run a simple Spark operation count = df.count() print(f"Number of rows in DataFrame: {count}") # Stop the SparkSession spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Apache Spark Quick Start - Python Source: https://accelerated-data-science.readthedocs.io/en/stable/ads.jobs This snippet provides a basic example of how to get started with Apache Spark integration within ADS. It demonstrates initial setup and common operations. Ensure Spark and necessary OCI connectors are configured. ```python from ads.spark.spark_session import get_default_spark_session # Get the default Spark session session = get_default_spark_session() # Example: Create a Spark DataFrame data = [('Alice', 1), ('Bob', 2)] columns = ['name', 'id'] df = session.createDataFrame(data, columns) # Show the DataFrame df.show() # Example: Performing a Spark action count = df.count() print(f"Number of rows: {count}") session.stop() print("Spark session stopped.") ``` -------------------------------- ### Example core-site.xml for Resource Principal Authentication Source: https://accelerated-data-science.readthedocs.io/en/stable/_sources/user_guide/apachespark/setup-installation An example XML configuration for the core-site.xml file demonstrating how to set up authentication to Object Storage using resource principals. It specifies the Object Storage hostname and the custom authenticator class. ```xml fs.oci.client.hostname https://objectstorage.us-ashburn-1.oraclecloud.com fs.oci.client.custom.authenticator com.oracle.bmc.hdfs.auth.ResourcePrincipalsCustomAuthenticator ``` -------------------------------- ### Apache Spark Quick Start and Setup (Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/horovod/creating Provides a quick start guide and setup instructions for integrating Apache Spark with OCI Data Flow using the ADS library. This covers basic configuration and running Spark applications. It requires OCI SDK and Spark environment. ```python # Example: Submitting a Spark job using ADS # from ads.jobs import SparkJob # from ads.secrets import Secrets # # Ensure you have your OCI credentials configured # # Secrets.load() # spark_job = SparkJob( # compartment_id='ocid1.compartment.oc1..exampleuniqueID', # display_name='MySparkJob', # driver_shape='OC3', # executor_shape='OC3', # num_executors=1, # executor_cores=1, # executor_memory_mb=4096, # archive_uri='oci://your-bucket@your-namespace/path/to/your_archive.zip', # main_jar_uri='oci://your-bucket@your-namespace/path/to/your_spark_app.jar', # arguments=['arg1', 'arg2'] # ) # # Submit the job # job_run = spark_job.submit() # print(f'Submitted Spark job run: {job_run.id}') ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/overview Provides a starting point for using Apache Spark with ADS. This includes initial setup and configuration steps required to run Spark applications, particularly on Oracle Cloud Infrastructure (OCI) Data Flow. Ensure Spark and necessary OCI components are installed and configured. ```python from pyspark.sql import SparkSession # Initialize SparkSession # For OCI Data Flow, the session is often pre-configured. # For local testing, you might use: # spark = SparkSession.builder.appName("ADSSparkQuickStart").getOrCreate() # Example: Create a SparkSession (adapt for OCI Data Flow context if needed) try: spark = SparkSession.builder.appName("ADSSparkQuickStart").getOrCreate() print("SparkSession created successfully.") # Example Spark operation: Create a DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() print("Basic Spark operations are working.") except Exception as e: print(f"Error creating or using SparkSession: {e}") finally: if 'spark' in locals() and spark: spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Connecting with Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/cli/distributed-training Provides a quick start guide for connecting and using Apache Spark within the ADS environment. This section focuses on basic setup and initial operations with Spark. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Example: Read data from a file (e.g., CSV) # try: # csv_df = spark.read.csv("path/to/your/data.csv", header=True, inferSchema=True) # csv_df.show() # except Exception as e: # print(f" ``` -------------------------------- ### Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/cli/authentication Provides a quick start guide for using Apache Spark with ADS. This section covers basic setup and execution of Spark applications, likely on OCI Data Flow. Requires OCI Data Flow setup and Spark knowledge. ```python from pyspark.sql import SparkSession # Initialize Spark Session # In OCI Data Flow, Spark session is often pre-configured. # For local testing, you might need a local Spark installation. spark = SparkSession.builder \ .appName("ADS Spark Quickstart") \ .getOrCreate() print("Spark session created successfully.") # Example Spark operation data = [("Alice", 1), ("Bob", 2), ("Charlie", 3)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() print("Spark DataFrame created and displayed.") # Stop Spark Session spark.stop() print("Spark session stopped.") ``` -------------------------------- ### Apache Spark Quick Start and Setup in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_registration/frameworks/sklearnmodel Offers a quick start guide and setup instructions for using Apache Spark with the ADS library in Python. This covers basic configurations and how to initiate Spark applications, particularly within the Oracle Cloud Infrastructure (OCI) Data Flow service. ```python from ads.spark.templates import SparkSubmitOperator from ads.common.auth import default_auth # Authenticate with OCI auth = default_auth() # Example: Using SparkSubmitOperator to run a Spark application # This operator is typically used within an ADS Pipeline or Job. # Parameters for SparkSubmitOperator would include: # application: Path to your Spark application script (e.g., 'oci://bucket@namespace/path/to/spark_app.py') # application_args: Arguments to pass to your Spark application # spark_home: Path to Spark installation (if running locally) # conf: Spark configuration properties (e.g., {'spark.executor.memory': '4g'}) # Example placeholder for operator instantiation: # spark_operator = SparkSubmitOperator( # application='oci://my-bucket@my-namespace/spark_scripts/word_count.py', # application_args=['oci://my-bucket@my-namespace/input_data/', 'oci://my-bucket@my-namespace/output_data/'], # conf={'spark.executor.cores': '2', 'spark.executor.memory': '4g'} # ) print("Apache Spark setup and Quick Start guide initiated.") print("Refer to ADS documentation for detailed SparkSubmitOperator usage.") ``` -------------------------------- ### Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/jobs/run_script This is a quick start guide for using Apache Spark within the ADS environment. It covers the basic setup and execution of Spark applications. ```python from pyspark.sql import SparkSession # Create a SparkSessionspark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Sample data data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] # Create a DataFrame df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Python: Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_serialization/overview A quick start guide for using Apache Spark with ADS. This snippet shows the initial setup for running Spark applications, likely involving connections to OCI services. ```python # This is a placeholder for a code snippet demonstrating Apache Spark quick start. # Actual code would involve importing SparkSession and configuring it for OCI. # from pyspark.sql import SparkSession # spark = SparkSession.builder \ # .appName("ADSSparkQuickstart") \ # .getOrCreate() # print("Spark session created.") # spark.stop() ``` -------------------------------- ### Getting Started with PII Operator Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/big_data_service/index This section provides a getting started guide for the PII (Personally Identifiable Information) Operator. It covers the initial setup and usage for identifying and handling sensitive data. The examples are for users needing to implement PII detection and masking. ```python from ads.openaimachines.pii import PIIOperator # Example: Getting started with PII Operator pii_operator = PIIOperator() pii_operator.run(data='data.csv', columns=['text_column']) ``` -------------------------------- ### Data Catalog Metastore - Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/large_language_model/deploy_langchain_application This snippet provides a quick start guide for using the Data Catalog Metastore. It outlines the initial steps required to connect to and interact with the metastore, likely involving client initialization and basic query operations. This is crucial for managing and discovering data assets. ```python from ads.catalog.metastore import MetastoreClient # Initialize the MetastoreClient # This typically involves authentication and configuration based on your OCI setup. # client = MetastoreClient() # Example: List available databases (conceptual) # try: # databases = client.list_databases() # print("Available databases:", databases) # except Exception as e: # print(f"Error connecting to metastore: {e}") print("MetastoreClient initialized. Use its methods to interact with the catalog.") ``` -------------------------------- ### Setup and Installation for Apache Spark (Bash) Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/big_data_service/quick_start Outlines the steps for setting up and installing Apache Spark. This often involves configuring environment variables, downloading Spark binaries, and setting up cluster configurations. ```bash # Example installation commands (may vary based on OS and distribution) # Download Spark from the official website # wget # tar -xzf spark-*.tgz # export SPARK_HOME=path/to/spark # export PATH=$SPARK_HOME/bin:$PATH # Configure spark-defaults.conf and workers files ``` -------------------------------- ### Connect with Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/operators/recommender_operator/quickstart Provides a Python quick start guide for connecting and interacting with Apache Spark, likely within an OCI environment managed by ADS. It covers basic Spark session setup. ```python # This is a conceptual example for Apache Spark quick start. # Actual implementation may vary based on the environment (e.g., OCI Data Flow, local setup). from pyspark.sql import SparkSession # Initialize SparkSession # The 'appName' is a name for your application shown in the Spark UI. # '.getOrCreate()' will create a new SparkSession or return an existing one. spark = SparkSession.builder \ .appName("SparkQuickStart") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Row1", 1), ("Row2", 2), ("Row3", 3)] columns = ["Name", "ID"] df = spark.createDataFrame(data, columns) # Show the DataFrame df.show() # Perform a simple transformation filtered_df = df.filter(df.ID > 1) filtered_df.show() # Stop the SparkSession when done # In OCI Data Flow, this might be handled automatically, but it's good practice. spark.stop() print("SparkSession stopped.") # To run this in OCI Data Flow, save it as a .py file and submit it via the OCI console or API. ``` -------------------------------- ### Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/feature_engineering/accessor/mixin/eda_mixin_series Provides a quick start guide for using Apache Spark with the ADS library in Python. This example demonstrates basic Spark operations and setup. ```Python from pyspark.sql import SparkSession # Initialize Spark Session spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) # Show the DataFrame df.show() # Stop Spark Session spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Apache Spark Quick Start for OCI Data Flow Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_registration/model_artifact This is a quick start guide for using Apache Spark on OCI Data Flow. It covers the initial setup and basic steps to get started with Spark applications in the OCI environment. ```python # Example of initializing SparkSession in OCI Data Flow from pyspark.sql import SparkSession spark = SparkSession.builder.appName("OCI_DataFlow_Spark").getOrCreate() # Your Spark code here spark.stop() ``` -------------------------------- ### Configure Recommender YAML File Source: https://accelerated-data-science.readthedocs.io/en/stable/_sources/user_guide/operators/recommender_operator/quickstart Provides the structure and an example of the 'recommender.yaml' configuration file. This file specifies input data sources, column mappings, and recommender parameters. ```yaml kind: operator type: recommendation version: v1 spec: user_data: url: users.csv item_data: url: items.csv interactions_data: url: interactions.csv top_k: 4 user_column: user_id item_column: movie_id interaction_column: rating ``` -------------------------------- ### Data Catalog Metastore Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/cli/opctl/local-development-setup Provides a quick start guide for using the Data Catalog Metastore. This snippet demonstrates the basic steps to connect to and interact with the metastore, likely for registering, discovering, and managing metadata for data assets. Requires OCI Data Catalog SDK or relevant client libraries. ```python # Conceptual example for OCI Data Catalog Metastore interaction # import oci # from oci.data_catalog.data_catalog_client import DataCatalogClient # config = oci.config.from_file() # catalog_client = DataCatalogClient(config=config) # compartment_id = "YOUR_COMPARTMENT_OCID" # catalog_id = "YOUR_CATALOG_OCID" # # Example: List catalogs (basic interaction) # try: # catalogs = catalog_client.list_catalogs(compartment_id=compartment_id) # for catalog in catalogs.data: # print(f"Catalog found: {catalog.display_name} ({catalog.id})") # except oci.exceptions.ServiceError as e: # print(f"Error listing catalogs: {e}") # Further interactions would involve creating/updating data assets, schemas, etc. ``` -------------------------------- ### Quick Start for Apache Spark Integration Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/large_language_model/index This section provides a quick start guide for integrating Apache Spark with OCI services. It covers the initial setup and basic steps to get started with running Spark applications on OCI Data Flow. ```bash # Example of submitting a Spark application using OCI CLI # Assumes Spark code is packaged and uploaded to Object Storage. oci data-flow application create \ --file-uri "objectStorage://your-bucket-name/path/to/your/spark_app.jar" \ --language "SCALA" \ --name "MySparkApp" \ --driver-shape "1OCI.OC4" \ --executor-shape "1OCI.OC4" \ --num-executors 3 \ --compartment-id ocid1.compartment.oc1.. ``` -------------------------------- ### Quick Start for Apache Spark Integration in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/pipeline/pipeline This snippet provides a basic example of how to get started with Apache Spark integration using the ADS library. It covers essential setup and running a simple Spark application. ```python from ads.spark import SparkSession # Create a SparkSession session = SparkSession.builder \ .appName("ADS Spark Quickstart") \ .getOrCreate() # Example: Create a Spark DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = session.createDataFrame(data, columns) # Show DataFrame df.show() # Stop the SparkSession session.stop() ``` -------------------------------- ### Data Catalog Metastore Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/common/oci_logging This section offers a quick start guide for integrating with the Data Catalog Metastore. It covers the initial steps to connect and utilize the metastore for data discovery and governance within the OCI environment. Assumes OCI Data Catalog service is enabled and configured. ```shell # Example of OCI CLI command to list Data Catalog metastores (conceptual) # oci data-catalog metastore list --compartment-id "ocid1.compartment.oc1..aaaaaaaaexamplecomponentid" # # # Example of OCI CLI command to list Data Catalogs within a metastore (conceptual) # oci data-catalog catalog list --metastore-id "ocid1.datacatalog.oc1.iad...." # # # Note: Actual integration code would involve using the OCI SDKs (Python, Java, etc.) # # to interact with the Data Catalog API for tasks like registering data assets, # # running harvests, and querying metadata. ``` -------------------------------- ### Quick Start for Apache Spark Integration in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_registration/model_schema A concise guide to getting started with Apache Spark integration within the ADS framework. It covers the initial setup and basic usage patterns for running Spark applications. ```python # Example: Using PySpark with ADS (conceptual - requires setup) # Ensure you have PySpark installed and configured with your environment. # from pyspark.sql import SparkSession # # Initialize Spark Session (example) # spark = SparkSession.builder \ # .appName("ADSSparkQuickStart") \ # .getOrCreate() # # Load data using Spark (example) # df = spark.read.csv("oci://your-bucket@your-namespace/path/to/data.csv", header=True, inferSchema=True) # df.show() # # Perform Spark operations (example) # filtered_df = df.filter(df['some_column'] > 10) # filtered_df.show() # # Stop Spark Session # spark.stop() print("This is a conceptual example for Apache Spark Quick Start.") print("Actual implementation requires PySpark and OCI configuration.") ``` -------------------------------- ### Data Catalog Metastore Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/pipeline/pipeline_step This provides a quick start guide for integrating with the Data Catalog Metastore. It likely involves setting up connections and performing basic operations to register or query metadata. Dependencies include the ADS library and OCI Data Catalog service. ```python from ads.catalog.metadata import MetadataClient # Initialize the MetadataClient # Ensure your OCI configuration (config file, environment variables) is set up try: client = MetadataClient() print("MetadataClient initialized successfully.") # Example: List available catalogs (replace with your actual query) # catalogs = client.list_catalogs() # print("Available Catalogs:", catalogs) # Example: Get information about a specific catalog (replace with your catalog OCID) # catalog_ocid = "ocid1.catalog.oc1.iad...." # catalog_info = client.get_catalog(catalog_ocid) # print("Catalog Info:", catalog_info) print("You can now interact with the Data Catalog Metastore using the client.") except Exception as e: print(f"Error initializing MetadataClient or performing operations: {e}") ``` -------------------------------- ### Quick Start for Large Language Model (LLM) Integration Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/database/connection A concise guide to getting started with Large Language Model (LLM) integrations in ADS. This covers initial setup and basic usage patterns for LLM functionalities. ```python # Placeholder for potential LLM integration quick start code examples. # This might involve initializing LLM clients or models. ``` -------------------------------- ### Quick Start for Apache Spark Integration - Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/common/oci_mixin A concise guide to getting started with Apache Spark integration within the ADS environment. It covers basic setup and running Spark applications on OCI Data Flow. ```python from ads.spark import SparkSession # Create a SparkSession session = SparkSession.builder \ .appName("ADS Spark Example") \ .getOrCreate() # Example Spark DataFrame operation data = [("Alice", 1), ("Bob", 2)] df = session.createDataFrame(data, ["name", "id"]) df.show() # Stop the SparkSession session.stop() ``` -------------------------------- ### Data Catalog Metastore Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/evaluations A quick start guide for using the Data Catalog Metastore with Apache Spark. This likely covers initial setup, connecting Spark to the metastore, and performing basic metastore operations for data discovery and management. ```python from pyspark.sql import SparkSession # Initialize SparkSession with metastore configuration spark = SparkSession.builder \ .appName("DataCatalogMetastoreExample") \ .config("spark.sql.catalog.spark_catalog", "org.apache.spark.sql.delta.catalog.DeltaCatalog") \ .config("spark.sql.extensions", "io.delta.sql.DeltaSparkSessionExtension") \ .config("spark.databricks.delta.schema.autoMerge.enabled", "true") \ # Add configurations for connecting to OCI Data Catalog Metastore if applicable # Example: .config("spark.hadoop.fs.oci.client.auth.type", "instance_principal") \ # .config("spark.hadoop.fs.oci.region", "us-ashburn-1") \ .getOrCreate() # Example: Reading data from a table registered in the metastore # Assuming 'your_database.your_table' is registered in the metastore try: df = spark.table("your_database.your_table") df.show() except Exception as e: print(f"Error reading table: {e}") # Example: Creating a Delta table and registering it # data = [(1, "Alice"), (2, "Bob")] # columns = ["id", "name"] # df_to_save = spark.createDataFrame(data, columns) # df_to_save.write.format("delta").saveAsTable("your_database.new_table") # Stop the SparkSession spark.stop() ``` -------------------------------- ### Quick Start for Apache Spark Integration in ADS Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/bds/auth Provides a concise guide to getting started with Apache Spark integration within the Accelerated Data Science (ADS) library. It covers basic setup and running Spark applications. ```python from ads.spark.spark import Spark # Initialize Spark sessionspark_session = Spark.get_or_create_session() # Perform Spark operations data = [('Alice', 1), ('Bob', 2)] columns = ['name', 'id'] df = spark_session.createDataFrame(data, columns) df.show() # Stop the Spark session when done # spark_session.stop() ``` -------------------------------- ### Quick Start for Apache Spark Integration in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/jobs/builders/runtimes/python_runtime A brief guide to getting started with Apache Spark integration within the ADS framework. This section covers the initial setup and basic usage patterns for running Spark applications on OCI. ```python from ads.spark import SparkSession # Initialize SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quickstart") \ .getOrCreate() # Example Spark operation data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Quick Start for Recommender Operator Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/common/model_artifact Provides a quick start guide for the Recommender Operator. This section covers the fundamental steps to set up and run a recommendation system, including data requirements and basic configuration. ```yaml recommender_config: action: "recommend" data: type: "objectstorage" bucket: "your-data-bucket" namespace: "your-namespace" file: "user_item_interactions.csv" user_column: "user_id" item_column: "item_id" output: type: "objectstorage" bucket: "your-output-bucket" namespace: "your-namespace" file: "recommendations.csv" ``` -------------------------------- ### Apache Spark Quick Start (Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/feature_engineering/feature_type/category A quick start guide for integrating Apache Spark with ADS. This section provides basic examples and setup instructions to help users begin running Spark applications within the ADS environment. ```python # Example of initiating a SparkSession within ADS (conceptual) # This typically happens within a Spark-enabled environment provided by ADS. # from pyspark.sql import SparkSession # # # SparkSession is often pre-configured in ADS Spark environments. # # If not, you might initialize it like this: # spark = SparkSession.builder \ # .appName("ADSSparkQuickStart") \ # .getOrCreate() # # # Example Spark operation # data = [("Alice", 1), ("Bob", 2)] # columns = ["name", "id"] # df = spark.createDataFrame(data, columns) # df.show() # # spark.stop() ``` -------------------------------- ### Distributed Training with Dask Getting Started Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/jobs/run_script This is an introductory example for distributed training using Dask. It covers the basic setup of a Dask cluster and client for parallel computation. ```python from dask.distributed import Client, LocalCluster # Create a local Dask cluster cluster = LocalCluster() # Connect a client to the cluster client = Client(cluster) print(f"Dask dashboard link: {client.dashboard_link}") # Now you can use the client to submit Dask delayed tasks or use Dask DataFrames/Arrays # For example: # import dask.array as da # x = da.random.random((10000, 10000), chunks=(1000, 1000)) # y = x.mean().compute() # Close the client and cluster when done # client.close() # cluster.close() ``` -------------------------------- ### Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/model_evaluation/binary_classification This section provides a quick start guide for using Apache Spark with the ADS library. It covers basic setup and common operations for leveraging Spark's distributed computing capabilities. Ensure Spark is installed and accessible. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName('ADS Spark Quick Start') \ .getOrCreate() # Example: Load data into a Spark DataFrame data = [('Alice', 1), ('Bob', 2)] columns = ['name', 'id'] df = spark.createDataFrame(data, columns) df.show() # Example: Perform a Spark transformation processed_df = df.filter(df.id > 1) processed_df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Connecting with Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/data_labeling/parser/export_record_parser Provides a quick start guide for integrating with Apache Spark using the ADS library. This snippet demonstrates basic setup and connection to a Spark environment, likely on OCI Data Flow. It requires PySpark to be installed. ```python from pyspark.sql import SparkSession # Create a SparkSession # In a managed environment like OCI Data Flow, SparkSession might be pre-configured. # Otherwise, you might need to configure it explicitly. spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["Name", "ID"] df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Setup and Installation for Apache Spark Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/database/connection Detailed instructions for setting up and installing Apache Spark integration with ADS. This ensures all necessary components and configurations are in place. ```bash # Example commands for setting up Spark environment # These commands would typically involve installing Spark or configuring existing installations. # Example: export SPARK_HOME=/path/to/spark ``` -------------------------------- ### Basic ADS Initialization and Hello World Source: https://accelerated-data-science.readthedocs.io/en/stable/index Demonstrates how to import the ADS library and call the `hello()` function. This is a simple check to ensure the library is installed and working correctly, also showing version information. ```python import ads >>> ads.hello() ``` -------------------------------- ### Quick Start for AI Forecast Operator Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/big_data_service/index This section provides a quick start guide for the AI Forecast Operator. It covers the basic steps required to begin using the operator for time-series forecasting tasks. The examples are intended for new users to quickly get up and running with forecasting. ```python from ads.openaimachines.forecast import ForecastOperator # Example: Quick start for Forecast Operator forecast_operator = ForecastOperator() forecast_operator.run(data='data.csv', target_column='sales', time_column='date') ``` -------------------------------- ### Apache Spark Quick Start in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/model/deployment/model_deployment Provides a quick start guide for using Apache Spark with ADS. This typically involves setting up a Spark environment and performing basic Spark operations. ```python from pyspark.sql import SparkSession # Create a SparkSession # In a managed environment like OCI Data Science, SparkSession might be pre-configured. # For local setup, you might need to configure Spark differently. spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() print("SparkSession created successfully.") # Example: Create a DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Example: Perform a simple Spark operation filtered_df = df.filter(df.id > 1) filtered_df.show() # Stop the SparkSession spark.stop() print("SparkSession stopped.") ``` -------------------------------- ### Quick Start for Apache Spark Integration in Python Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/apachespark/spark Provides a basic example of how to get started with Apache Spark integration using the ADS library. This snippet demonstrates setting up a Spark environment and performing a simple Spark operation. It assumes Spark is installed or accessible via OCI services. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Example Spark operation data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Anomaly Detection Operator Quick Start (YAML/Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/_modules/ads/opctl/distributed/common/cluster_config_helper Offers a quick start guide for the Anomaly Detection Operator. This section includes example configurations (YAML) and potentially Python code to initiate anomaly detection tasks on datasets. It covers basic setup for identifying unusual patterns. ```yaml # Example anomaly_detection_config.yaml for Anomaly Detection Operator kind: AnomalyDetectionOperator apiVersion: data.ads.oracle.com/v1alpha1 metadata: name: my-anomaly-detection-job spec: dataset: uri: "oci://my-bucket@my-tenancy/data/sensor_readings.csv" timestamp_column: "timestamp" value_columns: - "temperature" - "pressure" # Additional parameters for model type, sensitivity, etc. ``` ```python from ads.operators.ml import AnomalyDetectionOperator # Load configuration from YAML operator = AnomalyDetectionOperator.from_yaml("anomaly_detection_config.yaml") # Execute the anomaly detection task operator.execute() # Access detected anomalies or model artifacts print(operator.get_artifact()) ``` -------------------------------- ### Quick Start for Recommender Operator Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/big_data_service/index This section offers a quick start guide for the Recommender Operator. It outlines the basic steps to begin using the operator for generating recommendations. The examples are intended for users to quickly implement recommendation systems. ```python from ads.openaimachines.recommender import RecommenderOperator # Example: Quick start for Recommender Operator recommender_operator = RecommenderOperator() recommender_operator.run(data='interactions.csv', user_col='user_id', item_col='item_id') ``` -------------------------------- ### Apache Spark Quick Start (Python) Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/secrets/auth_token Provides a quick start guide for using Apache Spark with the ADS toolkit. This section covers the initial steps required to set up and run Spark applications, likely focusing on integration with OCI services for data processing and analytics. It serves as an entry point for users new to Spark within the ADS ecosystem. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Example: Create a simple DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) # Show the DataFrame df.show() # Stop the SparkSession spark.stop() ``` -------------------------------- ### Python: Quick Start for AI Forecast Operator Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/operators/anomaly_detection_operator/index Provides a basic example of using the AI Forecast Operator for time-series forecasting. This snippet demonstrates the minimal configuration required to get started, including specifying the data source and target column. It assumes the necessary ADS components are installed. ```python from ads.opto.forecast import ForecastOperator # Initialize the Forecast Operator # forecast_operator = ForecastOperator( # target_column='your_forecast_column', # date_column='your_date_column' # ) # Load your data into an ADSDataset object # dataset = ADSDataset(source='/path/to/your/time_series_data.csv') # Perform forecasting # forecast_result = forecast_operator.fit(dataset).predict() # Display the forecast results # print(forecast_result.head()) ``` -------------------------------- ### Connecting to Apache Spark with ADS Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/model_training/distributed_training/horovod/coding This code demonstrates the initial steps for connecting to Apache Spark using the Accelerated Data Science (ADS) library. The 'Quick Start' guide likely involves setting up the Spark environment and establishing a connection, which is crucial for big data processing tasks within ADS. ```python from ads.spark import SparkSession # Assuming Spark is configured and accessible s = SparkSession.builder.appName("ADS Spark Example").getOrCreate() print("Spark session created successfully.") print(f"Spark version: {s.version}") ``` -------------------------------- ### Python: Apache Spark Quick Start Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/operators/pii_operator/install Provides a quick start guide for using Apache Spark within the ADS environment. This includes basic examples of setting up Spark, running simple Spark jobs, and demonstrating how to leverage Spark for big data processing tasks. ```python from pyspark.sql import SparkSession # Create a SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quick Start") \ .getOrCreate() # Example: Create a DataFrame data = [("Alice", 1), ("Bob", 2)] columns = ["name", "id"] df = spark.createDataFrame(data, columns) df.show() # Example: Read data from a file (e.g., CSV) # try: # csv_df = spark.read.csv("/path/to/your/data.csv", header=True, inferSchema=True) # csv_df.show() # except Exception as e: # print(f"Error reading CSV: {e}") # Example: Perform a simple Spark transformation filtered_df = df.filter(df.id > 1) filtered_df.show() # Stop the SparkSession spark.stop() print("Spark session stopped.") ``` -------------------------------- ### Quick Start for Apache Spark Integration Source: https://accelerated-data-science.readthedocs.io/en/stable/user_guide/jobs/run_notebook Provides a concise introduction to integrating Apache Spark with OCI Data Science. This guide covers the essential steps to get started, likely including setting up Spark environments and basic data processing examples. It assumes Spark is available in the OCI environment. ```python # Example: Initializing SparkSession within an OCI Data Science Notebook from pyspark.sql import SparkSession spark = SparkSession.builder \ .appName("ADS Spark Quickstart") \ .getOrCreate() # Example: Reading data from OCI Object Storage using Spark # Ensure OCI credentials and region are configured object_storage_path = "oci://your-bucket-name@your-region/path/to/data.csv" dataframe = spark.read.csv(object_storage_path, header=True, inferSchema=True) dataframe.show() # Stop the SparkSession when done spark.stop() ```