Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
8345be11
Commit
8345be11
authored
6 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
use another strategy to avoid matplotlib backend error
Former-commit-id: d20b0efb39ae273a99bfdfa19d9fe216afe2ec7b
parent
a66174d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/management/commands/pca.py
+1
-1
1 addition, 1 deletion
ippisite/ippidb/management/commands/pca.py
with
1 addition
and
1 deletion
ippisite/ippidb/management/commands/pca.py
+
1
−
1
View file @
8345be11
...
@@ -6,7 +6,6 @@ import base64
...
@@ -6,7 +6,6 @@ import base64
from
django.core.management
import
BaseCommand
,
CommandError
from
django.core.management
import
BaseCommand
,
CommandError
from
django.forms.models
import
model_to_dict
from
django.forms.models
import
model_to_dict
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
matplotlib
.
use
(
'
Agg
'
)
import
pandas
as
pd
import
pandas
as
pd
import
numpy
as
np
import
numpy
as
np
from
sklearn.decomposition
import
PCA
from
sklearn.decomposition
import
PCA
...
@@ -55,6 +54,7 @@ class Command(BaseCommand):
...
@@ -55,6 +54,7 @@ class Command(BaseCommand):
pca
=
PCA
(
n_components
=
2
)
pca
=
PCA
(
n_components
=
2
)
principal_components
=
pca
.
fit_transform
(
x
)
principal_components
=
pca
.
fit_transform
(
x
)
# compute correlation circle
# compute correlation circle
plt
.
switch_backend
(
'
Agg
'
)
variance_ratio
=
pd
.
Series
(
pca
.
explained_variance_ratio_
)
variance_ratio
=
pd
.
Series
(
pca
.
explained_variance_ratio_
)
coef
=
np
.
transpose
(
pca
.
components_
)
coef
=
np
.
transpose
(
pca
.
components_
)
cols
=
[
'
PC-
'
+
str
(
x
)
for
x
in
range
(
len
(
variance_ratio
))]
cols
=
[
'
PC-
'
+
str
(
x
)
for
x
in
range
(
len
(
variance_ratio
))]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment