Skip to content

Commit

Permalink
[ML-35] Restrict printNumericTable to first 10 eigenvalues with first…
Browse files Browse the repository at this point in the history
… 20 dimensions (#36)

* restrict PCA printNumericTable to first 10 eigenvalues with first 20 dimensions

* fix ALS printNumericTable
  • Loading branch information
xwu99 committed Mar 19, 2021
1 parent c07d70c commit b4708a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mllib-dal/src/main/native/ALSDALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ JNIEXPORT jlong JNICALL Java_org_apache_spark_ml_recommendation_ALSDALImpl_cDALI

std::cout << "\n=== Results for Rank " << rankId << "===\n" << std::endl;
// std::cout << "Partition ID: " << partitionId << std::endl;
printNumericTable(pUser, "User Factors (first 10 rows):", 10);
printNumericTable(pItem, "Item Factors (first 10 rows):", 10);
printNumericTable(pUser, "User Factors (first 10 rows x 20 columns):", 10, 20);
printNumericTable(pItem, "Item Factors (first 10 rows x 20 columns):", 10, 20);
std::cout << "User Offset: " << getOffsetFromOffsetTable(userOffset) << std::endl;
std::cout << "Item Offset: " << getOffsetFromOffsetTable(itemOffset) << std::endl;
std::cout << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions mllib-dal/src/main/native/PCADALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ JNIEXPORT jlong JNICALL Java_org_apache_spark_ml_feature_PCADALImpl_cPCATrainDAL
std::cout << "PCA (native): master step took " << duration << " secs" << std::endl;

/* Print the results */
printNumericTable(result->get(pca::eigenvalues), "First 10 Eigenvalues:", 10);
printNumericTable(result->get(pca::eigenvectors), "First 10 Eigenvectors:", 10);
printNumericTable(result->get(pca::eigenvalues), "First 10 eigenvalues with first 20 dimensions:", 10, 20);
printNumericTable(result->get(pca::eigenvectors), "First 10 eigenvectors with first 20 dimensions:", 10, 20);

// Return all eigenvalues & eigenvectors

Expand Down

0 comments on commit b4708a4

Please sign in to comment.