Search code examples
phpamazon-web-servicesamazon-personalize

AWS Personalize — algorithmHyperParameters must be an associative array. Found array


According to documentation (https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-personalize-2018-05-22.html#createsolution), when you create solution, you must provide algorithmHyperParameters as array of strings, so I did:

'solutionConfig' => [
    'algorithmHyperParameters' => [
        'min_copurchase_count',
        'exponentiation_parameter',
    ],
    ...
],

But script fails with error:

Fatal error: Uncaught InvalidArgumentException: Found 1 error while validating the input provided for the CreateSolution operation:
[solutionConfig][algorithmHyperParameters] must be an associative array. Found array(2) in /var/www/vendor/aws/aws-sdk-php/src/Api/Validator.php:65

How algorithmHyperParameters can be an associative array in this case? I have tried to make it as associative array, but I have not found any valid.

Can someone help to figure this out? Thanks in advance.


Solution

  • There is a mistake in this documentation, because in other documentation (https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolution.html) this parameter is:

    1. Does not required.
    2. If you need it, it should be like:
    'solutionConfig' => [
        'algorithmHyperParameters' => [
            '<string>' => '<string>',
        ],
        ...
    ],