Skip to content

Conversation

@aryakrekhi
Copy link

No description provided.

@codecov
Copy link

codecov bot commented May 1, 2022

Codecov Report

Merging #263 (ec996dc) into master (191b71b) will decrease coverage by 0.16%.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##           master    #263      +/-   ##
=========================================
- Coverage    6.54%   6.37%   -0.17%     
=========================================
  Files          19      20       +1     
  Lines         688     706      +18     
=========================================
  Hits           45      45              
- Misses        643     661      +18     
Flag Coverage Δ
unittests 6.37% <0.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tfac/PCA_functions.py 0.00% <0.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@Farnazmdi Farnazmdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly recommend running figure1 first (make output/figure1.svg) and taking a look at the plots to see where we are at.
Then you can use figure 1e to see how many components to use for PCA.
As I mentioned below, please write your scores and loadings plot function in the plotHelpers.py.
After these, we will focus on what to annotate and what to plot to see the repeating patterns.

Comment on lines +9 to +16
def R2X_plot(datafile):
R2X_list = []
data = StandardScaler().Tensor_LINCS_MEMA(data)
for x in range(2, 21):
PCA_model = PCA(n_components=x)
PCA_model.fit(data)
R2X_list.append(np.sum(PCA_model.explained_variance_ratio_) * 100)
plt.plot(range(2, 21), R2X_list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to write an R2X function. You can use the one from tensorpack (take a look at figure1 to see how to use it.) I believe we don't need an R2X plot. Just run it for yourself to decide how many components you want. Although, you can decide from the reduction plot, too (figure1e).

Comment on lines +18 to +22
def scores_plot(datafile):
data = StandardScaler().Tensor_LINCS_MEMA(datafile)
PCA_model = PCA(n_components=2)
pca_scores = PCA_model.fit_transform(data)
plt.scatter(pca_scores[:,0], pca_scores[:,1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can write the scores and loadings plot in the plotHelpers.py file.

@@ -0,0 +1,24 @@
"""Contains function for performing PCA on OHSU data"""
from dataHelpers import Tensor_LINCS_MEMA
from sklearn.preprocessing import StandardScaler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the data has already been normalized in the importing function, so you don't need to do it again.

@Farnazmdi
Copy link
Contributor

@aryakrekhi please do git pull before making changes.

@Farnazmdi
Copy link
Contributor

Please do git pull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants