Skip to content

Factorization Machine #194

Closed
Closed

Description

@ChandraLingam

Please fill out the form below.

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): SageMaker/Factorization Machine
  • Framework Version:
  • Python Version:
  • CPU or GPU:
  • Python SDK Version:
  • Are you using a custom image:

Describe the problem

Is factorization machine designed to work only with binary features? Do we need to one hot encode all features? How are real-valued features handled?

Minimal repro / logs

General Query on algorithm supported

  • Exact command to reproduce:

Activity

  1. yangaws commented on May 24, 2018

    @yangaws
    Contributor

    Hi @ChandraLingam ,

    Factorization Machines is not limited to using binary features. All features, binary or not, can be represented in sparse format as a list of vector_index:value pairs.

  2. ChandraLingam commented on May 25, 2018

    @ChandraLingam
    Author

    Hi @yangaws - Thank you for the clarification.

    For Factorization Machines, SageMaker accepts only recordIO/protobuf formatted input.

    What is the recommended process for converting a sparse matrix to recordio/protobuf format?

    I used scikit OneHotEncoder to encode my data and it returns a CSR Sparse matrix.

    How do I convert this CSR Sparse Matrix efficiently into recordIO file?

  3. winstonaws commented on May 25, 2018

    @winstonaws
    Contributor

    One way to do so is to use the data conversion functions provided in sagemaker.amazon.common in the sagemaker python SDK. I think this should work: https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/amazon/common.py#L113

  4. ChandraLingam commented on May 26, 2018

    @ChandraLingam
    Author

    Yes, I found out about that method after searching for it and tested it with my dataset. Thank you!

  5. Sandy4321 commented on Mar 19, 2019

    @Sandy4321

    may you share example how to use write_spmatrix_to_sparse_tensor?

  6. yangaws commented on Mar 21, 2019

    @yangaws
    Contributor

    Hi @Sandy4321 ,

    We have unit tests for this function here:
    https://github.com/aws/sagemaker-python-sdk/blob/master/tests/unit/test_common.py#L66

    These tests will illustrate basic usage of this function. Feel free to reply if you have further questions.

  7. yangaws commented on Mar 21, 2019

    @yangaws
    Contributor

    @Sandy4321

    Let's use #707 to track this issue. If you have more questions, please reply #707.

    Thanks

  8. added a commit that references this issue on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions