For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/ja/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/ja/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/ja/developers-python-sdk-segmentation.md.
  • 🇯🇵 日本語
  • カスタムアクションでセグメンテーション(およびペリメーター)を使用する

    カスタムアクションでは、セグメンテーションシステムを完全に活用し、さらに進めることができます

    目的

    カスタムアクションでは、セグメンテーションシステムを完全に活用し、さらに進めることができます:

    • 複雑なアルゴリズムの計算を並列化する
    • 大規模なカスタムデータの読み込みを並列化する
    • など

    他の互換性のあるアクションタイプと同様に、インターフェースを通じて、または高度なJSONモードを通じて、セグメンテーションの種類と値を設定できます。 詳細については、セグメンテーションのドキュメントページを参照してください。

    ここでは、セグメンテーションの設定と値をカスタムPythonスクリプトで取得する方法を学びます。これにより、必要に応じて適用できます。 ソースにフィルタを適用する例を掘り下げてみましょう。

    import sys
    from logging import getLogger
    
    from forepaas.core.settings import PARAMS
    from forepaas.dwh import connect
    from forepaas.dwh import bulk_insert
    
    logger = logging.getLogger(__name__)
    
    def my_custom(event):
    	try:
    		# get the segmentation and perimeter settings
    		segmentation = PARAMS.get("segmentation",{})
    		segmentationValues = PARAMS.get("segmentation",{}).get("values")
    		perimeter = PARAMS.get("perimeter",{})
    		perimeterValues = PARAMS.get("perimeter",{}).get("values")
    
    		# set a filter dict regarding the segmentation and perimeter configuration
    		filters = {}
    		if segmentation["type"] in ["workflow_dates", "dwh_attributes", "predefined_set"] and segmentationValues is not None: 
    			filters[segmentation["var_name"]] = segmentationValues
    		if perimeter["type"] in ["workflow_dates", "dwh_attributes", "predefined_set"] and perimeterValues is not None: 
    			filters[perimeter["var_name"]] = perimeterValues
    
    		cn = connect("dwh/default_dataset/")
    
    		# extract with filters
    		df = cn.select(table_name, filters)
    
    		# perform some changes on the df optionaly 
    		# df = df
    
    		# insert into destination
    		bulk_insert(cn, table_destination, df)
    
    		# close connection
    		del cn
    	except Exception as err: 
    		raise Exception("err:{} L:{}".format(err,sys.exc_info()[2].tb_lineno))
    

    さらに詳しく

    当社のソリューションを実装するためのトレーニングや技術サポートが必要な場合は、営業担当者にお問い合わせください、またはこのリンクをクリックして、当社のプロフェッショナルサービスの専門家にプロジェクトのカスタム分析を依頼する見積もりを取得してください。

    Data Platformを構築するチームと直接質問し、フィードバックを共有し、交流するには、専用のDiscordチャネルにアクセスしてください。

    OVHcloudサービスについてサポートが必要な場合は、ヘルプセンターでリクエストを作成してください。

    ユーザーコミュニティに参加してください。