From 50f6c74586e9625edd62de78f08a759881c2e3ef Mon Sep 17 00:00:00 2001 From: mleprovost Date: Thu, 11 Jun 2020 09:04:20 -0700 Subject: [PATCH] Upgrade code to julia 1.4 --- Manifest.toml | 467 ++++++++++++++++++++++++++++++++++++++++++++++ Project.toml | 15 ++ REQUIRE | 4 - src/GraphLasso.jl | 35 +++- test/runtests.jl | 33 ++-- 5 files changed, 532 insertions(+), 22 deletions(-) create mode 100644 Manifest.toml create mode 100644 Project.toml delete mode 100644 REQUIRE diff --git a/Manifest.toml b/Manifest.toml new file mode 100644 index 0000000..2bc14d4 --- /dev/null +++ b/Manifest.toml @@ -0,0 +1,467 @@ +# This file is machine-generated - editing it directly is not advised + +[[AbstractFFTs]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "051c95d6836228d120f5f4b984dd5aba1624f716" +uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" +version = "0.5.0" + +[[Arpack]] +deps = ["Arpack_jll", "Libdl", "LinearAlgebra"] +git-tree-sha1 = "2ff92b71ba1747c5fdd541f8fc87736d82f40ec9" +uuid = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" +version = "0.4.0" + +[[Arpack_jll]] +deps = ["Libdl", "OpenBLAS_jll", "Pkg"] +git-tree-sha1 = "e214a9b9bd1b4e1b4f15b22c0994862b66af7ff7" +uuid = "68821587-b530-5797-8361-c406ea357684" +version = "3.5.0+3" + +[[Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[CSV]] +deps = ["CategoricalArrays", "DataFrames", "Dates", "FilePathsBase", "Mmap", "Parsers", "PooledArrays", "Tables", "Unicode", "WeakRefStrings"] +git-tree-sha1 = "52a8e60c7822f53d57e4403b7f2811e7e1bdd32b" +uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +version = "0.6.2" + +[[CategoricalArrays]] +deps = ["DataAPI", "Future", "JSON", "Missings", "Printf", "Statistics", "Unicode"] +git-tree-sha1 = "a6c17353ee38ddab30e73dcfaa1107752de724ec" +uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597" +version = "0.8.1" + +[[CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.0" + +[[Compat]] +deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] +git-tree-sha1 = "37964a28fa8231d769faa10eec8c4436253c48ba" +uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" +version = "3.11.0" + +[[CompilerSupportLibraries_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612" +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "0.3.3+0" + +[[DSP]] +deps = ["FFTW", "IterTools", "LinearAlgebra", "Polynomials", "Random", "Reexport", "SpecialFunctions", "Statistics"] +git-tree-sha1 = "d52dce57c6108ef552c14799e7fcdcae6c681084" +uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2" +version = "0.6.7" + +[[DataAPI]] +git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.3.0" + +[[DataFrames]] +deps = ["CategoricalArrays", "Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "Missings", "PooledArrays", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] +git-tree-sha1 = "02f08ae77249b7f6d4186b081a016fb7454c616f" +uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +version = "0.21.2" + +[[DataStructures]] +deps = ["InteractiveUtils", "OrderedCollections"] +git-tree-sha1 = "af6d9c86e191c917c2276fbede1137e8ea20157f" +uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +version = "0.17.17" + +[[DataValueInterfaces]] +git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" +uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" +version = "1.0.0" + +[[Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" + +[[DelimitedFiles]] +deps = ["Mmap"] +uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" + +[[Distributed]] +deps = ["Random", "Serialization", "Sockets"] +uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" + +[[Distributions]] +deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"] +git-tree-sha1 = "78c4c32a2357a00a0a7d614880f02c2c6e1ec73c" +uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" +version = "0.23.4" + +[[ExprTools]] +git-tree-sha1 = "6f0517056812fd6aa3af23d4b70d5325a2ae4e95" +uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" +version = "0.1.1" + +[[EzXML]] +deps = ["Printf", "XML2_jll"] +git-tree-sha1 = "0fa3b52a04a4e210aeb1626def9c90df3ae65268" +uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615" +version = "1.1.0" + +[[FFTW]] +deps = ["AbstractFFTs", "FFTW_jll", "IntelOpenMP_jll", "Libdl", "LinearAlgebra", "MKL_jll", "Reexport"] +git-tree-sha1 = "14536c95939aadcee44014728a459d2fe3ca9acf" +uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" +version = "1.2.2" + +[[FFTW_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "6c975cd606128d45d1df432fb812d6eb10fee00b" +uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a" +version = "3.3.9+5" + +[[FileIO]] +deps = ["Pkg"] +git-tree-sha1 = "202335fd24c2776493e198d6c66a6d910400a895" +uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" +version = "1.3.0" + +[[FilePathsBase]] +deps = ["Dates", "LinearAlgebra", "Printf", "Test", "UUIDs"] +git-tree-sha1 = "923fd3b942a11712435682eaa95cc8518c428b2c" +uuid = "48062228-2e41-5def-b9a4-89aafe57970f" +version = "0.8.0" + +[[FillArrays]] +deps = ["LinearAlgebra", "Random", "SparseArrays"] +git-tree-sha1 = "44f561e293987ffc84272cd3d2b14b0b93123d63" +uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" +version = "0.8.10" + +[[Future]] +deps = ["Random"] +uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" + +[[GLM]] +deps = ["Distributions", "LinearAlgebra", "Printf", "Random", "Reexport", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "StatsModels"] +git-tree-sha1 = "db0ace36f9dbe7b6a7a08434c5921377e9df2c72" +uuid = "38e38edf-8417-5370-95a0-9cbb8c7f171a" +version = "1.3.9" + +[[Graphs]] +deps = ["DataStructures", "SparseArrays"] +git-tree-sha1 = "9409e40f53532c45f2478c33531aa7a65ec4e2de" +uuid = "86223c79-3864-5bf0-83f7-82e725a168b6" +version = "0.10.3" + +[[IntelOpenMP_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "fb8e1c7a5594ba56f9011310790e03b5384998d6" +uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" +version = "2018.0.3+0" + +[[InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[Intervals]] +deps = ["Dates", "Printf", "RecipesBase", "TimeZones"] +git-tree-sha1 = "11555ad4a66a93e2268364f2ea11139634f9dda3" +uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" +version = "1.2.0" + +[[InvertedIndices]] +deps = ["Test"] +git-tree-sha1 = "15732c475062348b0165684ffe28e85ea8396afc" +uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" +version = "1.0.0" + +[[IterTools]] +git-tree-sha1 = "05110a2ab1fc5f932622ffea2a003221f4782c18" +uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" +version = "1.3.0" + +[[IteratorInterfaceExtensions]] +git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" +uuid = "82899510-4779-5014-852e-03e436cf321d" +version = "1.0.0" + +[[JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.0" + +[[Lasso]] +deps = ["DSP", "Distributions", "GLM", "LinearAlgebra", "MLBase", "Random", "Reexport", "SparseArrays", "StatsBase", "StatsModels"] +git-tree-sha1 = "b1deb00733e0b599b9f321eefaa0e6f295957765" +uuid = "b4fcebef-c861-5a0f-a7e2-ba9dc32b180a" +version = "0.5.0" + +[[LibGit2]] +deps = ["Printf"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" + +[[Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" + +[[Libiconv_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "e5256a3b0ebc710dbd6da0c0b212164a3681037f" +uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" +version = "1.16.0+2" + +[[LinearAlgebra]] +deps = ["Libdl"] +uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + +[[Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" + +[[MKL_jll]] +deps = ["IntelOpenMP_jll", "Libdl", "Pkg"] +git-tree-sha1 = "0ce9a7fa68c70cf83c49d05d2c04d91b47404b08" +uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" +version = "2020.1.216+0" + +[[MLBase]] +deps = ["IterTools", "Random", "Reexport", "StatsBase", "Test"] +git-tree-sha1 = "f63a8d37429568b8c4384d76c4a96fc2897d6ddf" +uuid = "f0e99cf1-93fa-52ec-9ecc-5026115318e0" +version = "0.8.0" + +[[Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "de0a5ce9e5289f27df672ffabef4d1e5861247d5" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "0.4.3" + +[[Mmap]] +uuid = "a63ad114-7e13-5084-954f-fe012c677804" + +[[Mocking]] +deps = ["ExprTools"] +git-tree-sha1 = "916b850daad0d46b8c71f65f719c49957e9513ed" +uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" +version = "0.7.1" + +[[OpenBLAS_jll]] +deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] +git-tree-sha1 = "1887096f6897306a4662f7c5af936da7d5d1a062" +uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.9+4" + +[[OpenSpecFun_jll]] +deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] +git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.3+3" + +[[OrderedCollections]] +git-tree-sha1 = "12ce190210d278e12644bcadf5b21cbdcf225cd3" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.2.0" + +[[PDMats]] +deps = ["Arpack", "LinearAlgebra", "SparseArrays", "SuiteSparse", "Test"] +git-tree-sha1 = "2fc6f50ddd959e462f0a2dbc802ddf2a539c6e35" +uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" +version = "0.9.12" + +[[Parsers]] +deps = ["Dates", "Test"] +git-tree-sha1 = "eb3e09940c0d7ae01b01d9291ebad7b081c844d3" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "1.0.5" + +[[Pkg]] +deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" + +[[Polynomials]] +deps = ["Intervals", "LinearAlgebra", "RecipesBase"] +git-tree-sha1 = "05f4b8b55595b86b252b28fb1e7c402fb4df98d2" +uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" +version = "1.1.1" + +[[PooledArrays]] +deps = ["DataAPI"] +git-tree-sha1 = "b1333d4eced1826e15adbdf01a4ecaccca9d353c" +uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" +version = "0.5.3" + +[[Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[QuadGK]] +deps = ["DataStructures", "LinearAlgebra"] +git-tree-sha1 = "dc84e810393cfc6294248c9032a9cdacc14a3db4" +uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" +version = "2.3.1" + +[[RData]] +deps = ["CategoricalArrays", "CodecZlib", "DataFrames", "Dates", "FileIO", "Requires", "TimeZones", "Unicode"] +git-tree-sha1 = "10693c581956334a368c26b7c544e406c4c94385" +uuid = "df47a6cb-8c03-5eed-afd8-b6050d6c41da" +version = "0.7.2" + +[[RDatasets]] +deps = ["CSV", "CodecZlib", "DataFrames", "FileIO", "Printf", "RData", "Reexport"] +git-tree-sha1 = "522cd00e7354cb39208a6c8040b1ccc421862ca4" +uuid = "ce6b1742-4840-55fa-b093-852dadbb1d8b" +version = "0.6.8" + +[[REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[Random]] +deps = ["Serialization"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[[RecipesBase]] +git-tree-sha1 = "54f8ceb165a0f6d083f0d12cb4996f5367c6edbc" +uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +version = "1.0.1" + +[[Reexport]] +deps = ["Pkg"] +git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "0.2.0" + +[[Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "d37400976e98018ee840e0ca4f9d20baa231dc6b" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.0.1" + +[[Rmath]] +deps = ["Random", "Rmath_jll"] +git-tree-sha1 = "86c5647b565873641538d8f812c04e4c9dbeb370" +uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa" +version = "0.6.1" + +[[Rmath_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "d76185aa1f421306dec73c057aa384bad74188f0" +uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" +version = "0.2.2+1" + +[[SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" + +[[Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" + +[[SharedArrays]] +deps = ["Distributed", "Mmap", "Random", "Serialization"] +uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" + +[[ShiftedArrays]] +git-tree-sha1 = "22395afdcf37d6709a5a0766cc4a5ca52cb85ea0" +uuid = "1277b4bf-5013-50f5-be3d-901d8477a67a" +version = "1.0.0" + +[[Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[SortingAlgorithms]] +deps = ["DataStructures", "Random", "Test"] +git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "0.3.1" + +[[SparseArrays]] +deps = ["LinearAlgebra", "Random"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[[SpecialFunctions]] +deps = ["OpenSpecFun_jll"] +git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "0.10.3" + +[[Statistics]] +deps = ["LinearAlgebra", "SparseArrays"] +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" + +[[StatsBase]] +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"] +git-tree-sha1 = "a6102b1f364befdb05746f386b67c6b7e3262c45" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.33.0" + +[[StatsFuns]] +deps = ["Rmath", "SpecialFunctions"] +git-tree-sha1 = "04a5a8e6ab87966b43f247920eab053fd5fdc925" +uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" +version = "0.9.5" + +[[StatsModels]] +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "ShiftedArrays", "SparseArrays", "StatsBase", "Tables"] +git-tree-sha1 = "5a140e0bf5d92b2c5c0daa0dcefdadbb57c8a7fb" +uuid = "3eaba693-59b7-5ba5-a881-562e759f1c8d" +version = "0.6.11" + +[[SuiteSparse]] +deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] +uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" + +[[TableTraits]] +deps = ["IteratorInterfaceExtensions"] +git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e" +uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" +version = "1.0.0" + +[[Tables]] +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"] +git-tree-sha1 = "c45dcc27331febabc20d86cb3974ef095257dcf3" +uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" +version = "1.0.4" + +[[Test]] +deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[TimeZones]] +deps = ["Dates", "EzXML", "Mocking", "Printf", "RecipesBase", "Serialization", "Unicode"] +git-tree-sha1 = "db7bc2051d4c2e5f336409224df81485c00de6cb" +uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" +version = "1.2.0" + +[[TranscodingStreams]] +deps = ["Random", "Test"] +git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c" +uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +version = "0.9.5" + +[[UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[[Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" + +[[WeakRefStrings]] +deps = ["DataAPI", "Random", "Test"] +git-tree-sha1 = "28807f85197eaad3cbd2330386fac1dcb9e7e11d" +uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" +version = "0.6.2" + +[[XML2_jll]] +deps = ["Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"] +git-tree-sha1 = "987c02a43fa10a491a5f0f7c46a6d3559ed6a8e2" +uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" +version = "2.9.9+4" + +[[Zlib_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "a2e0d558f6031002e380a90613b199e37a8565bf" +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.11+10" diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..6739054 --- /dev/null +++ b/Project.toml @@ -0,0 +1,15 @@ +name = "GraphLasso" +uuid = "d8dcc30c-3c10-4eda-aa94-386db4ade0b4" +authors = ["mleprovost "] +version = "0.1.0" + +[deps] +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" +Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +Lasso = "b4fcebef-c861-5a0f-a7e2-ba9dc32b180a" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 7f7ad6d..0000000 --- a/REQUIRE +++ /dev/null @@ -1,4 +0,0 @@ -julia 0.4 -Lasso -Graphs -DataFrames diff --git a/src/GraphLasso.jl b/src/GraphLasso.jl index 888458f..6bf1ca0 100644 --- a/src/GraphLasso.jl +++ b/src/GraphLasso.jl @@ -1,4 +1,5 @@ module GraphLasso +using LinearAlgebra, SparseArrays using DataFrames, Lasso, Graphs export graphlasso @@ -6,8 +7,8 @@ export graphlasso function graphlasso(S::Matrix{Float64}, α::Float64; tol::Float64=1e-5, maxit::Int=1000, penalize_diag::Bool=true, verbose::Bool=false) p = size(S,1) - adj = abs(S) .> α - blocks = connected_components(sparse2adjacencylist(sparse(max(adj, eye(p))))) + adj = convert(SparseMatrixCSC{Int64,Int64}, abs.(S) .> α) + blocks = connected_components(sparse2adjacencylist2(max.(adj, sparse(I, p, p)))) if(verbose) print(blocks) end @@ -24,7 +25,7 @@ function fit_block(S::Matrix{Float64}, α::Float64, tol::Float64, p = size(S,1) W = copy(S) if penalize_diag - W += α * eye(p) + W += α*I end if size(S,1) == 1 return W, inv(W) @@ -39,7 +40,7 @@ function fit_block(S::Matrix{Float64}, α::Float64, tol::Float64, inds = collect(1:p) splice!(inds, j) W11 = W[inds,inds] - sqrtW11 = sqrtm(W11) + sqrtW11 = sqrt(W11) β[:,j] = fit(LassoPath, sqrtW11, sqrtW11 \ S[inds,j], λ=[α/(p-1)], standardize=false, intercept=false).coefs W[inds,j] = W11 * β[:,j] @@ -61,4 +62,30 @@ function fit_block(S::Matrix{Float64}, α::Float64, tol::Float64, end return W, Θ end + +# Modify code from unmaintained Graph.jl +function sparse2adjacencylist2(A::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti<:Integer} + colptr = A.colptr + rowval = A.rowval + n = size(A, 1) + adjlist = Array{Array{Ti,1}}(undef, n) + s = 0 + for j in 1:n + adjj = Ti[] + sizehint!(adjj, colptr[j+1] - colptr[j] - 1) + for k in colptr[j]:(colptr[j+1] - 1) + rvk = A.rowval[k] + if rvk != j push!(adjj, rvk) end + end + s += length(adjj) + adjlist[j] = adjj + end + GenericAdjacencyList{Ti, UnitRange{Ti}, Vector{Vector{Ti}}}(!ishermitian(A), + one(Ti):convert(Ti,n), + s, adjlist) +end + + + end + diff --git a/test/runtests.jl b/test/runtests.jl index c79aa14..482608e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,15 +1,20 @@ -using GraphLasso, DataFrames, Distributions, RDatasets, Base.Test +using GraphLasso, DataFrames, Distributions, RDatasets +using LinearAlgebra +using Test -S_iris = cov(array(dataset("datasets", "iris")[:,1:4])) -α = 1.0 -W_R = [1.68569351 0.000000 0.2743155 0.01969989 - 0.00000000 1.189979 0.0000000 0.00000000 - 0.27431545 0.000000 4.1162779 0.29560940 - 0.01969989 0.000000 0.2956094 1.58100626] -Θ_R = [ 0.59973155 0.0000000 -0.03996709 0.00000000 - 0.00000000 0.8403507 0.00000000 0.00000000 - -0.03996708 0.0000000 0.24890787 -0.04604166 - 0.00000000 0.0000000 -0.04604166 0.64111722] -W_iris, Θ_iris = graphlasso(S_iris, α; tol=1e-6, penalize_diag=true) -@test_approx_eq_eps W_R W_iris 1e-5 -@test_approx_eq_eps Θ_R Θ_iris 1e-5 + +@testset "Test Graph Lasso" begin + S_iris = cov(Matrix(dataset("datasets", "iris")[:,1:4])) + α = 1.0 + W_R = [1.68569351 0.000000 0.2743155 0.01969989 + 0.00000000 1.189979 0.0000000 0.00000000 + 0.27431545 0.000000 4.1162779 0.29560940 + 0.01969989 0.000000 0.2956094 1.58100626] + Θ_R = [ 0.59973155 0.0000000 -0.03996709 0.00000000 + 0.00000000 0.8403507 0.00000000 0.00000000 + -0.03996708 0.0000000 0.24890787 -0.04604166 + 0.00000000 0.0000000 -0.04604166 0.64111722] + W_iris, Θ_iris = graphlasso(S_iris, α; tol=1e-6, penalize_diag=true) + @test norm(W_R-W_iris) < 1e-5 + @test norm(Θ_R-Θ_iris) < 1e-5 +end \ No newline at end of file