Skip to content

Commit

Permalink
update keras to keras3
Browse files Browse the repository at this point in the history
  • Loading branch information
maotian06 committed Aug 26, 2024
1 parent 656d3fc commit 940af1e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Authors@R: c(
person("Dan Knight", role = "ctb"))
Description: Multi-data type subtyping, which is data type agnostic and accepts missing data. Subtyping is performed using intermediary assessments created with autoencoders and similarity calculations.
Depends: R (>= 3.2.3)
Imports: ConsensusClusterPlus, cluster (>= 1.14.4), keras, tensorflow, philentropy
Imports: ConsensusClusterPlus, cluster (>= 1.14.4), keras3, tensorflow, philentropy
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
License: GPL-2
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ importFrom("grDevices", "colorRampPalette");
importFrom("cluster","diana");
importFrom("ConsensusClusterPlus","ConsensusClusterPlus","calcICL");
importFrom("philentropy","distance");
import(tensorflow, keras);
import(tensorflow, keras3);
2 changes: 1 addition & 1 deletion R/create.autoencoder.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ create.autoencoder <- function(
optimizer = 'adam'
);

ae.output.file <- paste0(sub('/$','',model.file.output.dir),'/',data.type,'_model.hdf5');
ae.output.file <- paste0(sub('/$','',model.file.output.dir),'/',data.type,'_model.keras');
checkpoint <- callback_model_checkpoint(
filepath = ae.output.file,
save_best_only = TRUE,
Expand Down
4 changes: 2 additions & 2 deletions R/create.autoencoder.irf.matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ create.autoencoder.irf.matrix <- function(
if (data.type %in% names(autoencoders)) {
# load the neural net for the data.type
model <- autoencoders[[data.type]];
if (is.character(autoencoders[[data.type]]) && grep('hdf5$',autoencoders[[data.type]]) == 1) {
model <- load_model_hdf5(
if (is.character(autoencoders[[data.type]]) && grep('keras$',autoencoders[[data.type]]) == 1) {
model <- load_model(
autoencoders[[data.type]],
compile = FALSE);
}
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ The first step is to load the data. Here the genomic features are rows and patie
```{r load-data}
# Load the library and the data included with the package
library(iSubGen);
library(tensorflow);
library(keras3);
library(reticulate);
molecular.data <- list();
for(i in c('cna','methy','snv')) {
molecular.data[[i]] <- load.molecular.aberration.data(
Expand Down Expand Up @@ -231,7 +235,7 @@ IRF: Independent Reduced Features.

iSubGen: integrative Subtype Generation. This tool!

Keras R package: [https://cran.r-project.org/package=keras](https://cran.r-project.org/package=keras)
keras R package: [https://cran.r-project.org/package=keras](https://cran.r-project.org/package=keras)

Methylation: a DNA modification where methyl groups of are added to cytosines in DNA to help regulate DNA transcription.

Expand Down
6 changes: 3 additions & 3 deletions man/create.autoencoder.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
\description{Create an autoencoder for dimensionality reduction using keras and tensorflow packages}
\usage{
create.autoencoder(data.type, data.matrix, encoder.layers.node.nums = c(15,2),
autoencoder.activation = 'tanh', optimization.loss.function = 'mean_squared_error',
autoencoder.activation = 'tanh', optimization.loss.function = 'mean_squared_error',
model.file.output.dir = '.')
}
\arguments{
\item{data.type}{data type ID. The ID will be used for naming the output file}
\item{data.matrix}{matrix with data features as rows and patients as columns}
\item{encoder.layers.node.nums}{vector with the number of nodes for each layer when the reducing the feature dimensions within the autoencoder. The autoencoder will be made symmetrically so the number of nodes in each layer will be used in reverse, not repeating the last layer to re encode the features in the autoencoder}
\item{encoder.layers.node.nums}{vector with the number of nodes for each layer when the reducing the feature dimensions within the autoencoder. The autoencoder will be made symmetrically so the number of nodes in each layer will be used in reverse, not repeating the last layer to re encode the features in the autoencoder}
\item{autoencoder.activation}{activation function to use in the autoencoder}
\item{optimization.loss.function}{loss function used for optimization while fitting the autoencoder}
\item{model.file.output.dir}{file location for the autoencoder file}
}
\value{
\item{autoencoder}{the autoencoder created by the keras package}
\item{autoencoder.file}{the hdf5 file that the model was saved in and can be loaded from}
\item{autoencoder.file}{the keras file that the model was saved in and can be loaded from}
}
\author{Natalie Fox}
\examples{
Expand Down
2 changes: 1 addition & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Description: 'Multi-data type subtyping, which is data type agnostic and accepts
Maintainers: '[email protected]'
Contributors: ['Natalie Fox', 'Paul C. Boutros', 'Mao Tian']
Languages: 'R'
Dependencies: ['ConsensusClusterPlus', 'cluster', 'keras', 'tensorflow', 'philentropy']
Dependencies: ['ConsensusClusterPlus', 'cluster', 'keras3', 'tensorflow', 'philentropy']
References: ''
2 changes: 1 addition & 1 deletion vignettes/iSubGenGuide.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ DNA segments can be deleted so there are less than 2 copies. \\

\noindent \textbf{iSubGen:} integrative Subtype Generation. This tool!\\

\noindent \textbf{Keras R package:} \url{https://cran.r-project.org/package=keras} \\
\noindent \textbf{keras R package:} \url{https://cran.r-project.org/package=keras} \\

\noindent \textbf{Methylation:} a DNA modification where methyl groups of are added to cytosines in DNA to help regulate DNA transcription. \\

Expand Down

0 comments on commit 940af1e

Please sign in to comment.