演算法準備就緒後,請指派給資源。
確認演算法是否已準備就緒
演算法模型必須先以最低資料量進行訓練,才能開始運作。
演算法會為每個可使用模型的廣告主訓練模型。模型會根據現有的曝光資料進行訓練。廣告主達到資料規定後,模型可能需要 1 至 3 天才能完成訓練。
從演算法擷取每個模型的完備性。ReadinessState 會決定後續步驟:
ReadinessState | |
|---|---|
READINESS_STATE_NO_VALID_SCRIPT |
沒有有效的指令碼。上傳新的指令碼或規則檔案。 |
READINESS_STATE_EVALUATION_FAILURE |
在指定時間內,沒有可評估的腳本。上傳新的指令碼或規則檔案。 |
READINESS_STATE_INSUFFICIENT_DATA |
廣告主提供的資料量不足,無法訓練模型。繼續在廣告主底下放送廣告活動,以達到最低資料要求。 |
READINESS_STATE_TRAINING |
模型正在根據現有資料進行訓練,尚未準備好提供服務。請等待 12 到 24 小時,再檢查模型是否已準備好提供服務。 |
READINESS_STATE_ACTIVE |
模型已完成訓練,可指派給廣告主底下的廣告活動。 |
將演算法指派給委刊項
系統會使用演算法評估及調整出價成效。這項功能可搭配出價策略使用,盡量花完預算或達成目標。在這些情況下,策略成效目標類型會是 BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO。
如要更新委刊項,改用出價策略搭配演算法,盡量花完預算,請按照下列步驟操作:
Java
// Provide the ID of the advertiser that owns the parent algorithm. long advertiserId = advertiser-id; // Provide the ID of the parent algorithm. long algorithmId = algorithm-id; // Provide the ID of the line item to assign the algorithm to. long lineItemId = line-item-id; // Create the line item structure. LineItem lineItem = new LineItem() .setBidStrategy( new BiddingStrategy() .setMaximizeSpendAutoBid( new MaximizeSpendBidStrategy() .setPerformanceGoalType( "BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO") .setCustomBiddingAlgorithmId(algorithmId))); // Configure the patch request and set update mask to only update the bid // strategy. LineItems.Patch request = service .advertisers() .lineItems() .patch(advertiserId, lineItemId, lineItem) .setUpdateMask("bidStrategy"); // Update the line item. LineItem response = request.execute(); // Display the new algorithm ID used by the line item. System.out.printf( "Line item %s now uses algorithm ID %s in its bidding strategy.", response.getName(), response.getBidStrategy().getMaximizeSpendAutoBid().getCustomBiddingAlgorithmId());
Python
# Provide the parent advertiser ID of the line item and creative. advertiser_id = advertiser-id # Provide the ID of the creative to assign. algorithm_id = algorithm-id # Provide the ID of the line item to assign the creative to. line_item_id = line-item-id # Build bidding strategy object. bidding_strategy_obj = { "maximizeSpendAutoBid": { "performanceGoalType": ( "BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO" ), "customBiddingAlgorithmId": algorithm_id, } } # Build line item object. line_item_obj = {"bidStrategy": bidding_strategy_obj} # Build and execute request. line_item_resp = ( service.advertisers() .lineItems() .patch( advertiserId=advertiser_id, lineItemId=line_item_id, updateMask="bidStrategy", body=line_item_obj, ) .execute() ) # Print the algorithm ID now assigned to the line item. print( f'Line Item {line_item_resp["name"]} now uses algorithm ID' f' {line_item_resp["bidStrategy"]["maximizeSpendAutoBid"]["customBiddingAlgorithmId"]}' " in its bidding strategy." )
PHP
// Provide the ID of the advertiser that owns the parent algorithm. $advertiserId = advertiser-id; // Provide the ID of the parent algorithm. $algorithmId = algorithm-id; // Provide the ID of the line item to assign the algorithm to. $lineItemId = line-item-id; // Create the bidding strategy structure. $maxSpendBidStrategy = new Google_ServiceDisplayVideo_MaximizeSpendBidStrategy(); $maxSpendBidStrategy->setPerformanceGoalType('BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO'); $maxSpendBidStrategy->setCustomBiddingAlgorithmId($algorithmId); $biddingStrategy = new Google_ServiceDisplayVideo_BiddingStrategy(); $biddingStrategy->setMaximizeSpendAutoBid($maxSpendBidStrategy); // Create the line item structure. $lineItem = new Google_Service_DisplayVideo_LineItem(); $lineItem->setBidStrategy($biddingStrategy); $optParams = array('updateMask' => 'bidStrategy'); // Call the API, updating the bid strategy for the identified line // item. try { $result = $this->service->advertisers_lineItems->patch( $advertiserId, $lineItemId, $lineItem, $optParams ); } catch (\Exception $e) { $this->renderError($e); return; } printf( '<p>Line Item %s now uses algorithm ID %s in its bid strategy.</p>', $result['name'], $result['bidStrategy']['maximizeSpendAutoBid']['customBiddingAlgorithmId'] );