Repository: JuliaML/MLUtils.jl
Pull request #36 (2022-02-04 21:42:52)

docs + datasubset is now obsview


Patch:
diff --git a/.gitignore b/.gitignore
index 0f84bed..fbc9da4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 *.jl.cov
 *.jl.mem
 /Manifest.toml
+docs/build
diff --git a/docs/Manifest.toml b/docs/Manifest.toml
new file mode 100644
index 0000000..2ba22b5
--- /dev/null
+++ b/docs/Manifest.toml
@@ -0,0 +1,276 @@
+# This file is machine-generated - editing it directly is not advised
+
+julia_version = "1.7.1"
+manifest_format = "2.0"
+
+[[deps.ANSIColoredPrinters]]
+git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
+uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
+version = "0.0.1"
+
+[[deps.ArgTools]]
+uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
+
+[[deps.Artifacts]]
+uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
+
+[[deps.Base64]]
+uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
+
+[[deps.ChainRulesCore]]
+deps = ["Compat", "LinearAlgebra", "SparseArrays"]
+git-tree-sha1 = "f9982ef575e19b0e5c7a98c6e75ee496c0f73a93"
+uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
+version = "1.12.0"
+
+[[deps.ChangesOfVariables]]
+deps = ["ChainRulesCore", "LinearAlgebra", "Test"]
+git-tree-sha1 = "bf98fa45a0a4cee295de98d4c1462be26345b9a1"
+uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
+version = "0.1.2"
+
+[[deps.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 = "44c37b4636bc54afac5c574d2d02b625349d6582"
+uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
+version = "3.41.0"
+
+[[deps.CompilerSupportLibraries_jll]]
+deps = ["Artifacts", "Libdl"]
+uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
+
+[[deps.DataAPI]]
+git-tree-sha1 = "cc70b17275652eb47bc9e5f81635981f13cea5c8"
+uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
+version = "1.9.0"
+
+[[deps.DataStructures]]
+deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
+git-tree-sha1 = "3daef5523dd2e769dad2365274f760ff5f282c7d"
+uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
+version = "0.18.11"
+
+[[deps.Dates]]
+deps = ["Printf"]
+uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
+
+[[deps.DelimitedFiles]]
+deps = ["Mmap"]
+uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
+
+[[deps.Distributed]]
+deps = ["Random", "Serialization", "Sockets"]
+uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
+
+[[deps.DocStringExtensions]]
+deps = ["LibGit2"]
+git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
+uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
+version = "0.8.6"
+
+[[deps.Documenter]]
+deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
+git-tree-sha1 = "75c6cf9d99e0efc79b724f5566726ad3ad010a01"
+uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+version = "0.27.12"
+
+[[deps.Downloads]]
+deps = ["ArgTools", "LibCURL", "NetworkOptions"]
+uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
+
+[[deps.IOCapture]]
+deps = ["Logging", "Random"]
+git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
+uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
+version = "0.2.2"
+
+[[deps.InteractiveUtils]]
+deps = ["Markdown"]
+uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
+
+[[deps.InverseFunctions]]
+deps = ["Test"]
+git-tree-sha1 = "a7254c0acd8e62f1ac75ad24d5db43f5f19f3c65"
+uuid = "3587e190-3f89-42d0-90ee-14403ec27112"
+version = "0.1.2"
+
+[[deps.IrrationalConstants]]
+git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151"
+uuid = "92d709cd-6900-40b7-9082-c6be49f344b6"
+version = "0.1.1"
+
+[[deps.JSON]]
+deps = ["Dates", "Mmap", "Parsers", "Unicode"]
+git-tree-sha1 = "8076680b162ada2a031f707ac7b4953e30667a37"
+uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
+version = "0.21.2"
+
+[[deps.LibCURL]]
+deps = ["LibCURL_jll", "MozillaCACerts_jll"]
+uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
+
+[[deps.LibCURL_jll]]
+deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
+uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
+
+[[deps.LibGit2]]
+deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
+uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
+
+[[deps.LibSSH2_jll]]
+deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
+uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
+
+[[deps.Libdl]]
+uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
+
+[[deps.LinearAlgebra]]
+deps = ["Libdl", "libblastrampoline_jll"]
+uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
+
+[[deps.LogExpFunctions]]
+deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"]
+git-tree-sha1 = "e5718a00af0ab9756305a0392832c8952c7426c1"
+uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
+version = "0.3.6"
+
+[[deps.Logging]]
+uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
+
+[[deps.MLUtils]]
+deps = ["DelimitedFiles", "Random", "ShowCases", "Statistics", "StatsBase"]
+path = "/home/carlo/.julia/dev/MLUtils"
+uuid = "f1d291b0-491e-4a28-83b9-f70985020b54"
+version = "0.1.0"
+
+[[deps.Markdown]]
+deps = ["Base64"]
+uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
+
+[[deps.MbedTLS_jll]]
+deps = ["Artifacts", "Libdl"]
+uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
+
+[[deps.Missings]]
+deps = ["DataAPI"]
+git-tree-sha1 = "bf210ce90b6c9eed32d25dbcae1ebc565df2687f"
+uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
+version = "1.0.2"
+
+[[deps.Mmap]]
+uuid = "a63ad114-7e13-5084-954f-fe012c677804"
+
+[[deps.MozillaCACerts_jll]]
+uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
+
+[[deps.NetworkOptions]]
+uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
+
+[[deps.OpenBLAS_jll]]
+deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
+uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
+
+[[deps.OrderedCollections]]
+git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
+uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
+version = "1.4.1"
+
+[[deps.Parsers]]
+deps = ["Dates"]
+git-tree-sha1 = "0b5cfbb704034b5b4c1869e36634438a047df065"
+uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
+version = "2.2.1"
+
+[[deps.Pkg]]
+deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
+uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
+
+[[deps.Printf]]
+deps = ["Unicode"]
+uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
+
+[[deps.REPL]]
+deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
+uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
+
+[[deps.Random]]
+deps = ["SHA", "Serialization"]
+uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
+
+[[deps.SHA]]
+uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
+
+[[deps.Serialization]]
+uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
+
+[[deps.SharedArrays]]
+deps = ["Distributed", "Mmap", "Random", "Serialization"]
+uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
+
+[[deps.ShowCases]]
+git-tree-sha1 = "7f534ad62ab2bd48591bdeac81994ea8c445e4a5"
+uuid = "605ecd9f-84a6-4c9e-81e2-4798472b76a3"
+version = "0.1.0"
+
+[[deps.Sockets]]
+uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
+
+[[deps.SortingAlgorithms]]
+deps = ["DataStructures"]
+git-tree-sha1 = "b3363d7460f7d098ca0912c69b082f75625d7508"
+uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
+version = "1.0.1"
+
+[[deps.SparseArrays]]
+deps = ["LinearAlgebra", "Random"]
+uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
+
+[[deps.Statistics]]
+deps = ["LinearAlgebra", "SparseArrays"]
+uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
+
+[[deps.StatsAPI]]
+git-tree-sha1 = "d88665adc9bcf45903013af0982e2fd05ae3d0a6"
+uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
+version = "1.2.0"
+
+[[deps.StatsBase]]
+deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"]
+git-tree-sha1 = "51383f2d367eb3b444c961d485c565e4c0cf4ba0"
+uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
+version = "0.33.14"
+
+[[deps.TOML]]
+deps = ["Dates"]
+uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
+
+[[deps.Tar]]
+deps = ["ArgTools", "SHA"]
+uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
+
+[[deps.Test]]
+deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
+uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
+
+[[deps.UUIDs]]
+deps = ["Random", "SHA"]
+uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
+
+[[deps.Unicode]]
+uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
+
+[[deps.Zlib_jll]]
+deps = ["Libdl"]
+uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
+
+[[deps.libblastrampoline_jll]]
+deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
+uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
+
+[[deps.nghttp2_jll]]
+deps = ["Artifacts", "Libdl"]
+uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
+
+[[deps.p7zip_jll]]
+deps = ["Artifacts", "Libdl"]
+uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
diff --git a/docs/Project.toml b/docs/Project.toml
new file mode 100644
index 0000000..1b92320
--- /dev/null
+++ b/docs/Project.toml
@@ -0,0 +1,3 @@
+[deps]
+Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
diff --git a/docs/make.jl b/docs/make.jl
new file mode 100644
index 0000000..dae4e07
--- /dev/null
+++ b/docs/make.jl
@@ -0,0 +1,26 @@
+using MLUtils
+using Documenter
+
+# Copy the README to the home page in docs, to avoid duplication.
+readme = readlines(joinpath(@__DIR__, "..", "README.md"))
+# indexbase = readlines("docs/src/indexbase.md")
+open(joinpath(@__DIR__, "src/index.md"), "w") do f
+    # for l in indexbase
+    #     println(f, l)
+    # end
+    for l in readme
+        println(f, l)
+    end
+end
+
+DocMeta.setdocmeta!(MLUtils, :DocTestSetup, :(using MLUtils); recursive=true)
+
+makedocs(;
+    modules=[MLUtils],
+    doctest=true, clean=true,     
+    sitename = "MLUtils.jl",
+    pages = ["Home" => "index.md",
+             "API" => "api.md"],
+)
+
+deploydocs(repo="github.com/JuliaML/MLUtils.jl.git")
diff --git a/docs/src/api.md b/docs/src/api.md
new file mode 100644
index 0000000..49bdaae
--- /dev/null
+++ b/docs/src/api.md
@@ -0,0 +1,64 @@
+# API Reference
+
+## Index
+
+```@index
+Order = [:type, :function]
+Modules = [MLUtils]
+Pages = ["api.md"]
+```
+
+## Docs
+
+```@autodocs
+Modules = [MLUtils]
+Pages   = ["utils.jl"]
+Private = false
+```
+
+```@docs
+batch
+batchsize
+batchview
+BatchView
+DataLoader
+eachobs
+filterobs
+getobs
+getobs!
+joinobs
+groupobs
+kfolds
+leavepout
+mapobs
+numobs
+obsview
+ObsView
+oversample
+MLUtils.rpad
+randobs
+rpad(::AbstractVector, ::Integer, ::Any)
+shuffleobs
+splitobs
+stack
+unbatch
+undersample
+unsqueeze
+unstack
+```
+
+
+## Datasets Docs
+
+```@docs
+Datasets.load_iris
+Datasets.load_line
+Datasets.load_poly
+Datasets.load_sin
+Datasets.load_spiral
+Datasets.make_sin
+Datasets.make_spiral
+Datasets.make_poly
+```
+
+
diff --git a/docs/src/index.md b/docs/src/index.md
new file mode 100644
index 0000000..6a3aeb8
--- /dev/null
+++ b/docs/src/index.md
@@ -0,0 +1,27 @@
+# MLUtils.jl
+
+[![Build Status](https://github.com/JuliaML/MLUtils.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaML/MLUtils.jl/actions/workflows/CI.yml?query=branch%3Amain)
+[![Coverage](https://codecov.io/gh/JuliaML/MLUtils.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaML/MLUtils.jl)
+
+`MLUtils.jl` defines interfaces and implement commonly used utilities for Machine Learning pipelines.
+
+## Features
+
+- An extensible dataset interface  (`numobs` and `getobs`).
+- Data iteration and dataloaders (`eachobs` and `DataLoader`).
+- Lazy data views (`datasubset`). 
+- Resampling procedures (`undersample` and `oversample`).
+- Train/test splits (`splitobs`) 
+- Data partitioning and aggregation tools (`batch`, `unbatch`, `chunk`, `group_counts`, `group_indices`).
+- Folds for cross-validation (`kfolds`, `leavepout`).
+- Datasets lazy tranformations (`mapobs`, `filterobs`, `groupobs`, `joinobs`, `shuffleobs`).
+- Toy datasets for demonstration purpose. 
+- Other data handling utilities (`flatten`, `normalise`, `unsqueeze`, `stack`, `unstack`).
+
+## Related Packages
+
+`MLUtils.jl` brings togheter functionalities previously found in [LearnBase.jl](https://github.com/JuliaML/LearnBase.jl) , [MLDataPattern.jl](https://github.com/JuliaML/MLDataPattern.jl) and [MLLabelUtils.jl](https://github.com/JuliaML/MLLabelUtils.jl). These packages are now discontinued. 
+
+Other features were ported from the deep learning library [`Flux.jl`](https://github.com/FluxML/Flux.jl), as they are of general use. 
+
+[` MLJ.jl`](https://alan-turing-institute.github.io/MLJ.jl/dev/) is a more complete package for managing the whole machine learning pipeline if you are looking for a sklearn replacement.
diff --git a/src/MLUtils.jl b/src/MLUtils.jl
index 29a32d6..86be3a2 100644
--- a/src/MLUtils.jl
+++ b/src/MLUtils.jl
@@ -34,8 +34,8 @@ export kfolds,
        leavepout
 
 include("obsview.jl")
-export datasubset,
-       obsview, ObsView
+export obsview,
+       ObsView
 
 include("randobs.jl")
 export randobs
diff --git a/src/batchview.jl b/src/batchview.jl
index 435592c..df32708 100644
--- a/src/batchview.jl
+++ b/src/batchview.jl
@@ -2,10 +2,6 @@
     BatchView(data, batchsize; partial=true)
     BatchView(data; batchsize=1, partial=true)
 
-
-Description
-============
-
 Create a view of the given `data` that represents it as a vector
 of batches. Each batch will contain an equal amount of
 observations in them. The batch-size
@@ -13,18 +9,21 @@ can be specified using the  parameter `batchsize`.
 In the case that the size of the dataset is not dividable by the
 specified `batchsize`, the remaining observations will
 be ignored if `partial=false`. If  `partial=true` instead 
-the last batch-size can be slight smaller.
+the last batch-size can be slightly smaller.
 
 Note that any data access is delayed until `getindex` is called,
-and even `getindex` returns the result of [`obsview`](@ref)
+and even `getindex` returns an [`ObsView`](@ref)
 which in general avoids data movement until [`getobs`](@ref) is
 called.
 
 If used as an iterator, the object will iterate over the dataset
 once, effectively denoting an epoch. 
 
-Arguments
-==========
+For `BatchView` to work on some data structure, the type of the
+given variable `data` must implement the data container
+interface. See [`ObsView`](@ref) for more info.
+
+# Arguments
 
 - **`data`** : The object describing the dataset. Can be of any
     type as long as it implements [`getobs`](@ref) and
@@ -37,29 +36,20 @@ Arguments
 - **`partial`** : If `partial=false` and the number of observations is 
     not divisible by the batch-size, then the last mini-batch is dropped.
 
-Details
-========
-
-For `BatchView` to work on some data structure, the type of the
-given variable `data` must implement the data container
-interface. See `?ObsView` for more info.
-
+# Examples
 
-Examples
-=========
-
-```julia
+```jldoctest
 using MLUtils
 X, Y = MLUtils.load_iris()
 
-A = batchview(X, batchsize = 30)
+A = batchview(X, batchsize=30)
 @assert typeof(A) <: BatchView <: AbstractVector
 @assert eltype(A) <: SubArray{Float64,2}
 @assert length(A) == 5 # Iris has 150 observations
 @assert size(A[1]) == (4,30) # Iris has 4 features
 
 # 5 batches of size 30 observations
-for x in batchview(X, batchsize = 30)
+for x in batchview(X, batchsize=30)
     @assert typeof(x) <: SubArray{Float64,2}
     @assert numobs(x) === 30
 end
@@ -68,7 +58,7 @@ end
 # Note that the iris dataset has 150 observations,
 # which means that with a batchsize of 20, the last
 # 10 observations will be ignored
-for (x,y) in batchview((X,Y), batchsize = 20, partial=false)
+for (x, y) in batchview((X, Y), batchsize=20, partial=false)
     @assert typeof(x) <: SubArray{Float64,2}
     @assert typeof(y) <: SubArray{String,1}
     @assert numobs(x) == numobs(y) == 20
@@ -76,17 +66,11 @@ end
 
 
 # randomly assign observations to one and only one batch.
-for (x,y) in batchview(shuffleobs((X,Y)), batchsize=20)
+for (x, y) in batchview(shuffleobs((X, Y)), batchsize=20)
     @assert typeof(x) <: SubArray{Float64,2}
     @assert typeof(y) <: SubArray{String,1}
 end
 ```
-
-see also
-=========
-
-[`eachbatch`](@ref), [`ObsView`](@ref), [`shuffleobs`](@ref),
-[`getobs`](@ref), [`numobs`](@ref), [`ObsView`](@ref)
 """
 struct BatchView{TElem,TData} <: AbstractDataContainer
     data::TData
@@ -105,7 +89,7 @@ function BatchView(data::T; batchsize::Int=1, partial::Bool=true) where {T}
         @warn "Number of observations less than batch-size, decreasing the batch-size to $n"
         batchsize = n
     end
-    E = typeof(datasubset(data, 1:batchsize))
+    E = typeof(obsview(data, 1:batchsize))
     imax = partial ? n : n - batchsize + 1
     count = partial ? ceil(Int, n / batchsize) : floor(Int, n / batchsize)
     BatchView{E,T}(data, batchsize, count, partial, imax)
@@ -130,15 +114,15 @@ end
 Base.parent(A::BatchView) = A.data
 Base.eltype(::BatchView{Tel}) where Tel = Tel
 
-Base.getindex(A::BatchView, i::Int) = datasubset(A.data, _batchrange(A, i))
+Base.getindex(A::BatchView, i::Int) = obsview(A.data, _batchrange(A, i))
 
 function Base.getindex(A::BatchView, is::AbstractVector)
     obsindices = union((_batchrange(A, i) for i in is)...)::Vector{Int}
-    datasubset(A.data, obsindices)
+    obsview(A.data, obsindices)
 end
 
-datasubset(A::BatchView) = A
-datasubset(A::BatchView, i) = A[i]
+obsview(A::BatchView) = A
+obsview(A::BatchView, i) = A[i]
 
 # Helper function to translate a batch-index into a range of observations.
 function _batchrange(a::BatchView, batchindex::Int)
diff --git a/src/eachobs.jl b/src/eachobs.jl
index bfc26a8..abf9f5b 100644
--- a/src/eachobs.jl
+++ b/src/eachobs.jl
@@ -29,7 +29,7 @@ for x in eachobs(X)
 end
 
 # mini-batch iterations
-for x in eachbatch(X, batchsize=10)
+for x in eachobs(X, batchsize=10)
     # loop entered 10 times
     @assert typeof(x) <: Matrix{Float64}
     @assert size(x) == (4,10)
diff --git a/src/folds.jl b/src/folds.jl
index 8a008a4..ff33692 100644
--- a/src/folds.jl
+++ b/src/folds.jl
@@ -101,20 +101,20 @@ for (x_train, x_val) in kfolds(shuffleobs(X), k = 10)
 end
 ```
 
-See [`leaveout`](@ref) for a related function.
+See [`leavepout`](@ref) for a related function.
 """
 function kfolds(data, k::Integer)
     n = numobs(data)
     train_indices, val_indices = kfolds(n, k)
 
-    ((datasubset(data, itrain), datasubset(data, ival)) 
+    ((obsview(data, itrain), obsview(data, ival)) 
         for (itrain, ival) in zip(train_indices, val_indices))
 end
 
 kfolds(data; k) = kfolds(data, k)
 
 """
-    leaveout(n::Integer, [size = 1]) -> Tuple
+    leavepout(n::Integer, [size = 1]) -> Tuple
 
 Compute the train/validation assignments for `k ≈ n/size`
 repartitions of `n` observations, and return them in the form of
@@ -125,7 +125,7 @@ either `size` or `size+1` observations assigned to it. The
 following code snippet generates the index-vectors for `size = 2`.
 
 ```julia
-julia> train_idx, val_idx = leaveout(10, 2);
+julia> train_idx, val_idx = leavepout(10, 2);
 ```
 
 Each observation is assigned to the validation subset once (and
diff --git a/src/obstransform.jl b/src/obstransform.jl
index 29704a7..a5630f5 100644
--- a/src/obstransform.jl
+++ b/src/obstransform.jl
@@ -91,7 +91,7 @@ numobs(fdata) == 5
 ```
 """
 function filterobs(f, data; iterfn = _iterobs)
-    return datasubset(data, [i for (i, obs) in enumerate(iterfn(data)) if f(obs)])
+    return obsview(data, [i for (i, obs) in enumerate(iterfn(data)) if f(obs)])
 end
 
 _iterobs(data) = [getobs(data, i) for i = 1:numobs(data)]
@@ -121,7 +121,7 @@ function groupobs(f, data)
             push!(groups[group], i)
         end
     end
-    return Dict(group => datasubset(data, idxs) for (group, idxs) in groups)
+    return Dict(group => obsview(data, idxs) for (group, idxs) in groups)
 end
 
 # joinumobs
@@ -191,5 +191,5 @@ for more information.
 shuffleobs(data) = shuffleobs(Random.GLOBAL_RNG, data)
 
 function shuffleobs(rng::AbstractRNG, data)
-    datasubset(data, randperm(rng, numobs(data)))
+    obsview(data, randperm(rng, numobs(data)))
 end
diff --git a/src/obsview.jl b/src/obsview.jl
index b51603a..9c1fb63 100644
--- a/src/obsview.jl
+++ b/src/obsview.jl
@@ -1,9 +1,6 @@
 """
     ObsView(data, [indices])
 
-Description
-============
-
 Used to represent a subset of some `data` of arbitrary type by
 storing which observation-indices the subset spans. Furthermore,
 subsequent subsettings are accumulated without needing to access
@@ -18,18 +15,13 @@ load the required data only when needed.
 
 Any data access is delayed until `getindex` is called, 
 and even `getindex` returns the result of
-[`datasubset`](@ref) which in general avoids data movement until
+[`obsview`](@ref) which in general avoids data movement until
 [`getobs`](@ref) is called.
 If used as an iterator, the view will iterate over the dataset
 once, effectively denoting an epoch. Each iteration will return a
 lazy subset to the current observation.
 
-This type is usually not constructed manually, but instead
-instantiated by calling [`obsview`](@ref),
-[`shuffleobs`](@ref), or [`splitobs`](@ref)
-
-Arguments
-==========
+# Arguments
 
 - **`data`** : The object describing the dataset. Can be of any
     type as long as it implements [`getobs`](@ref) and
@@ -39,8 +31,7 @@ Arguments
     observation(s) in `data` that the subset should represent.
     Can be of type `Int` or some subtype of `AbstractVector`.
 
-Methods
-========
+# Methods
 
 - **`getindex`** : Returns the observation(s) of the given
     index/indices. No data is copied aside
@@ -54,8 +45,7 @@ Methods
     not directly correspond to the same indices in the underlying
     data set.
 
-Details
-========
+# Details
 
 For `ObsView` to work on some data structure, the desired type
 `MyType` must implement the following interface:
@@ -75,22 +65,19 @@ The following methods can also be provided and are optional:
     If that is not the behaviour that you want for your type,
     you need to provide this method as well.
 
-- `datasubset(data::MyType, idx)` :
+- `obsview(data::MyType, idx)` :
     If your custom type has its own kind of subset type, you can
     return it here. An example for such a case are `SubArray` for
     representing a subset of some `AbstractArray`.
-   
+
 - `getobs!(buffer, data::MyType, [idx])` :
     Inplace version of `getobs(data, idx)`. If this method
-    is provided for `MyType`, then `eachobs` and `eachbatch`
-    (among others) can preallocate a buffer that is then reused
+    is provided for `MyType`, then `eachobs` can preallocate a buffer that is then reused
     every iteration. Note: `buffer` should be equivalent to the
     return value of `getobs(::MyType, ...)`, since this is how
     `buffer` is preallocated by default.
 
-
-Examples
-=========
+# Examples
 
 ```julia
 X, Y = MLUtils.load_iris()
@@ -99,47 +86,46 @@ X, Y = MLUtils.load_iris()
 @assert size(X) == (4,150)
 
 # Represents the 80 observations as a ObsView
-v = obsview(X, 21:100)
+v = ObsView(X, 21:100)
 @assert numobs(v) == 80
 @assert typeof(v) <: ObsView
 # getobs indexes into v
 @assert getobs(v, 1:10) == X[:, 21:30]
 
-# Use `datasubset` to avoid boxing into ObsView
+# Use `obsview` to avoid boxing into ObsView
 # for types that provide a custom "subset", such as arrays.
 # Here it instead creates a native SubArray.
-v = datasubset(X, 1:100)
+v = obsview(X, 1:100)
 @assert numobs(v) == 100
 @assert typeof(v) <: SubArray
 
 # Also works for tuples of arbitrary length
-subset = datasubset((X, Y), 1:100)
+subset = obsview((X, Y), 1:100)
 @assert numobs(subset) == 100
 @assert typeof(subset) <: Tuple # tuple of SubArray
 
 # Use as iterator
-for x in obsview(X)
+for x in ObsView(X)
     @assert typeof(x) <: SubArray{Float64,1}
 end
 
 # iterate over each individual labeled observation
-for (x, y) in obsview((X, Y))
+for (x, y) in ObsView((X, Y))
     @assert typeof(x) <: SubArray{Float64,1}
     @assert typeof(y) <: String
 end
 
 # same but in random order
-for (x, y) in obsview(shuffleobs((X, Y)))
+for (x, y) in ObsView(shuffleobs((X, Y)))
     @assert typeof(x) <: SubArray{Float64,1}
     @assert typeof(y) <: String
 end
 
 # Indexing: take first 10 observations
-x, y = obsview((X, Y))[1:10]
+x, y = ObsView((X, Y))[1:10]
 ```
 
-See also
-=========
+# See also
 
 [`obsview`](@ref),  [`getobs`](@ref), [`numobs`](@ref),
 [`splitobs`](@ref), [`shuffleobs`](@ref),
@@ -194,7 +180,7 @@ Base.IteratorEltype(::Type{<:ObsView}) = Base.EltypeUnknown()
 
 # override AbstractDataContainer defaults
 Base.getindex(subset::ObsView, idx) =
-    datasubset(subset.data, subset.indices[idx])
+    obsview(subset.data, subset.indices[idx])
 
 numobs(subset::ObsView) = length(subset.indices)
 
@@ -206,18 +192,16 @@ getobs!(buffer, subset::ObsView, idx) = getobs!(buffer, subset.data, subset.indi
 
 Base.parent(x::ObsView) = x.data
 
-@doc (@doc ObsView)
-const obsview = ObsView
 
 # --------------------------------------------------------------------
 
 """
-    datasubset(data, [indices])
+    obsview(data, [indices])
 
 Returns a lazy view of the observations in `data` that
 correspond to the given `indices`. No data will be copied except
-of the indices. It is similar to calling `ObsView(data,
-[indices])`, but returns a `SubArray` if the type of
+of the indices. It is similar to constructing an [`ObsView`](@ref), 
+but returns a `SubArray` if the type of
 `data` is `Array` or `SubArray`. Furthermore, this function may
 be extended for custom types of `data` that also want to provide
 their own subset-type.
@@ -230,15 +214,15 @@ If instead you want to get the subset of observations
 corresponding to the given `indices` in their native type, use
 `getobs`.
 
-See [`obsview`](@ref) for more information.
+See [`ObsView`](@ref) for more information.
 """
-datasubset(data, indices=1:numobs(data)) = ObsView(data, indices)
+obsview(data, indices=1:numobs(data)) = ObsView(data, indices)
 
 ##### Arrays / SubArrays
 
-datasubset(A::SubArray) = A
+obsview(A::SubArray) = A
 
-function datasubset(A::AbstractArray{T,N}, idx) where {T,N}
+function obsview(A::AbstractArray{T,N}, idx) where {T,N}
     I = ntuple(_ -> :, N-1)
     return view(A, I..., idx)
 end
@@ -246,6 +230,6 @@ end
 getobs(a::SubArray) = getobs(a.parent, last(a.indices))
 
 ##### Tuples / NamedTuples
-function datasubset(tup::Union{Tuple, NamedTuple}, indices)
-    map(data -> datasubset(data, indices), tup)
+function obsview(tup::Union{Tuple, NamedTuple}, indices)
+    map(data -> obsview(data, indices), tup)
 end
diff --git a/src/resample.jl b/src/resample.jl
index 0a1d60d..24ccff6 100644
--- a/src/resample.jl
+++ b/src/resample.jl
@@ -103,7 +103,7 @@ function oversample(data, classes; fraction=1, shuffle::Bool=true)
     end
 
     shuffle && shuffle!(inds)
-    return datasubset(data, inds)
+    return obsview(data, inds)
 end
 
 oversample(data::Tuple; kws...) = oversample(data, data[end]; kws...)
@@ -142,7 +142,7 @@ X_bal, Y_bal = undersample(X, Y)
 ```
 
 For this function to work, the type of `data` must implement
-[`nobs`](@ref) and [`getobs`](@ref). For example, the following
+[`numobs`](@ref) and [`getobs`](@ref). For example, the following
 code allows `undersample` to work on a `DataFrame`.
 
 ```julia
@@ -190,7 +190,7 @@ function undersample(data, classes; shuffle::Bool=true)
     end
 
     shuffle ? shuffle!(inds) : sort!(inds)
-    return datasubset(data, inds)
+    return obsview(data, inds)
 end
 
 undersample(data::Tuple; kws...) = undersample(data, data[end]; kws...)
diff --git a/src/splitobs.jl b/src/splitobs.jl
index fc5aabb..988e720 100644
--- a/src/splitobs.jl
+++ b/src/splitobs.jl
@@ -95,5 +95,5 @@ the target distribution.
 """
 function splitobs(data; at)
     n = numobs(data)
-    map(idx -> datasubset(data, idx), splitobs(n; at))
+    map(idx -> obsview(data, idx), splitobs(n; at))
 end
diff --git a/src/utils.jl b/src/utils.jl
index 1c773e4..9bc6bde 100644
--- a/src/utils.jl
+++ b/src/utils.jl
@@ -16,10 +16,12 @@ julia> unsqueeze([1 2; 3 4], dims=2)
 [:, :, 1] =
  1
  3
+
 [:, :, 2] =
  2
  4
 
+
 julia> xs = [[1, 2], [3, 4], [5, 6]]
 3-element Vector{Vector{Int64}}:
  [1, 2]


Test patch:
diff --git a/test/batchview.jl b/test/batchview.jl
index ee83ec5..293af36 100644
--- a/test/batchview.jl
+++ b/test/batchview.jl
@@ -1,4 +1,4 @@
-using MLUtils: datasubset
+using MLUtils: obsview
 
 @testset "BatchView" begin
     # @test BatchView <: AbstractVector
@@ -48,11 +48,11 @@ using MLUtils: datasubset
             @test @inferred(length(A)) == 3
             @test @inferred(batchsize(A)) == 5
             @test @inferred(size(A)) == (3,)
-            @test @inferred(getobs(A[2:3])) == getobs(BatchView(obsview(var, 6:15), batchsize=5))
-            @test @inferred(getobs(A[[1,3]])) == getobs(BatchView(obsview(var, [1:5..., 11:15...]), batchsize=5))
-            @test @inferred(A[1]) == datasubset(var, 1:5)
-            @test @inferred(A[2]) == datasubset(var, 6:10)
-            @test @inferred(A[3]) == datasubset(var, 11:15)
+            @test @inferred(getobs(A[2:3])) == getobs(BatchView(ObsView(var, 6:15), batchsize=5))
+            @test @inferred(getobs(A[[1,3]])) == getobs(BatchView(ObsView(var, [1:5..., 11:15...]), batchsize=5))
+            @test @inferred(A[1]) == obsview(var, 1:5)
+            @test @inferred(A[2]) == obsview(var, 6:10)
+            @test @inferred(A[3]) == obsview(var, 11:15)
             @test A[end] == A[3]
             @test @inferred(getobs(A,1)) == getobs(var, 1:5)
             @test @inferred(getobs(A,2)) == getobs(var, 6:10)
@@ -62,8 +62,8 @@ using MLUtils: datasubset
         for var in (vars..., tuples...)
             A = BatchView(var, batchsize=5)
             @test @inferred(getobs(A)) == var
-            @test A[2:3] == datasubset(var, [6:15;])
-            @test A[[1,3]] == datasubset(var, [1:5..., 11:15...])
+            @test A[2:3] == obsview(var, [6:15;])
+            @test A[[1,3]] == obsview(var, [1:5..., 11:15...])
         end
     end
 
@@ -72,24 +72,24 @@ using MLUtils: datasubset
         # for var in (vars..., tuples..., Xs, ys)
             for var in (vars[1], )
             A = BatchView(var, batchsize=3)
-            @test getobs(@inferred(obsview(A))) == @inferred(getobs(A))
-            @test_throws BoundsError obsview(A,1:6)
+            @test getobs(@inferred(ObsView(A))) == @inferred(getobs(A))
+            @test_throws BoundsError ObsView(A,1:6)
             
-            S = @inferred(obsview(A, 1:2))
+            S = @inferred(ObsView(A, 1:2))
             @test typeof(S) <: ObsView
             @test @inferred(numobs(S)) == 2
             @test @inferred(length(S)) == numobs(S)
             @test @inferred(size(S)) == (length(S),)
             @test getobs(@inferred(A[1:2])) == getobs(S)
             @test @inferred(getobs(A,1:2)) == getobs(S)
-            @test @inferred(getobs(S)) == getobs(BatchView(obsview(var,1:6),batchsize=3))
+            @test @inferred(getobs(S)) == getobs(BatchView(ObsView(var,1:6),batchsize=3))
             
             S = @inferred(ObsView(A, 1:2))
             @test typeof(S) <: ObsView
         end
         A = BatchView(X, batchsize=3)
         @test typeof(A.data) <: Array
-        S = @inferred(datasubset(A))
+        S = @inferred(obsview(A))
         S === A
     end
 
diff --git a/test/obsview.jl b/test/obsview.jl
index b37387b..2da9795 100644
--- a/test/obsview.jl
+++ b/test/obsview.jl
@@ -31,12 +31,12 @@
             @test @inferred(getobs(subset)) == getobs(var)
             @test @inferred(ObsView(subset)) === subset
             @test @inferred(ObsView(subset, 1:15)) === subset
-            @test subset[end] == datasubset(var, 15)
-            @test @inferred(subset[15]) == datasubset(var, 15)
-            @test @inferred(subset[2:5]) == datasubset(var, 2:5)
+            @test subset[end] == obsview(var, 15)
+            @test @inferred(subset[15]) == obsview(var, 15)
+            @test @inferred(subset[2:5]) == obsview(var, 2:5)
             for idx in (1:10, [1,10,15,3], [2])
-                @test ObsView(var)[idx] == datasubset(var, idx)
-                @test ObsView(var)[idx] == datasubset(var, collect(idx))
+                @test ObsView(var)[idx] == obsview(var, idx)
+                @test ObsView(var)[idx] == obsview(var, collect(idx))
                 subset = @inferred(ObsView(var, idx))
                 @test typeof(subset) <: ObsView{typeof(var), typeof(idx)}
                 @test subset.data === var
@@ -44,8 +44,8 @@
                 @test @inferred(numobs(subset)) === length(idx)
                 @test @inferred(getobs(subset)) == getobs(var, idx)
                 @test @inferred(ObsView(subset)) === subset
-                @test @inferred(subset[1]) == datasubset(var, idx[1])
-                @test numobs(subset[1:1]) == numobs(ObsView(var, datasubset(idx, 1:1)))
+                @test @inferred(subset[1]) == obsview(var, idx[1])
+                @test numobs(subset[1:1]) == numobs(ObsView(var, obsview(idx, 1:1)))
             end
         end
     end
@@ -69,12 +69,12 @@ end
             subset = @inferred(ObsView(var, 5:12))
             @test typeof(@inferred(getobs(subset))) <: Array{Float64,2}
             @test @inferred(numobs(subset)) == length(subset) == 8
-            @test @inferred(subset[2:5]) == datasubset(X, 6:9)
-            @test @inferred(subset[3:6]) != datasubset(X, 6:9)
+            @test @inferred(subset[2:5]) == obsview(X, 6:9)
+            @test @inferred(subset[3:6]) != obsview(X, 6:9)
             @test @inferred(getobs(subset, 2:5)) == X[:, 6:9]
             @test @inferred(getobs(subset, [3,1,4])) == X[:, [7,5,8]]
             @test typeof(subset[2:5]) <: SubArray
-            @test @inferred(subset[collect(2:5)]) == datasubset(X, collect(6:9))
+            @test @inferred(subset[collect(2:5)]) == obsview(X, collect(6:9))
             @test typeof(subset[collect(2:5)]) <: SubArray
             @test @inferred(getobs(subset)) == getobs(subset[1:end]) == X[:, 5:12]
         end
@@ -85,82 +85,19 @@ end
             subset = @inferred(ObsView(var, 6:10))
             @test typeof(getobs(subset)) <: Array{String,1}
             @test @inferred(numobs(subset)) == length(subset) == 5
-            @test @inferred(subset[2:3]) == datasubset(y, 7:8)
+            @test @inferred(subset[2:3]) == obsview(y, 7:8)
             @test @inferred(getobs(subset, 2:3)) == y[7:8]
             @test @inferred(getobs(subset, [2,1,4])) == y[[7,6,9]]
             @test typeof(subset[2:3]) <: SubArray
-            @test @inferred(subset[collect(2:3)]) == datasubset(y, collect(7:8))
+            @test @inferred(subset[collect(2:3)]) == obsview(y, collect(7:8))
             @test typeof(subset[collect(2:3)]) <: SubArray
             @test @inferred(getobs(subset)) == getobs(subset[1:end]) == y[6:10]
         end
     end
 end
 
-@testset "obsview" begin
-    @testset "Array and SubArray" begin
-    #     @test @inferred(obsview(X)) == Xv
-    #     @test @inferred(obsview(X)) == Xv
-    #     @test @inferred(obsview(X)) == Xv
-    #     @test typeof(obsview(X)) <: SubArray
-    #     @test @inferred(obsview(Xv)) === Xv
-    #     @test @inferred(obsview(XX)) == XX
-    #     @test @inferred(obsview(XXX)) == XXX
-    #     @test typeof(obsview(XXX)) <: SubArray
-    #     @test @inferred(obsview(y)) == y
-    #     @test typeof(obsview(y)) <: SubArray
-    #     @test @inferred(obsview(yv)) === yv
-        for i in (2, 1:15, 2:10, [2,5,7], [2,1])
-            @test @inferred(obsview(X)[i])   == view(X,:,i)
-            @test @inferred(obsview(Xv)[i])  == view(X,:,i)
-            @test @inferred(obsview(Xv)[i])  == view(Xv,:,i)
-            @test @inferred(obsview(XX)[i])  == view(XX,:,:,i)
-            @test @inferred(obsview(XXX)[i]) == view(XXX,:,:,:,i)
-            @test @inferred(obsview(y)[i])   == view(y,i)
-            @test @inferred(obsview(yv)[i])  == view(y,i)
-            @test @inferred(obsview(yv)[i])  == view(yv,i)
-            @test @inferred(obsview(Y)[i])   == view(Y,:,i)
-        end
-    end
-
-    @testset "Tuple of Array and Subarray" begin
-        # @test @inferred(obsview((X,y)))   == (X,y)
-        # @test @inferred(obsview((X,yv)))  == (X,yv)
-        # @test @inferred(obsview((Xv,y)))  == (Xv,y)
-        # @test @inferred(obsview((Xv,yv))) == (Xv,yv)
-        # @test @inferred(obsview((X,Y)))   == (X,Y)
-        # @test @inferred(obsview((XX,X,y))) == (XX,X,y)
-        for i in (1:15, 2:10, [2,5,7], [2,1])
-            @test @inferred(obsview((X,y))[i])   == (view(X,:,i), view(y,i))
-            @test @inferred(obsview((Xv,y))[i])  == (view(X,:,i), view(y,i))
-            @test @inferred(obsview((X,yv))[i])  == (view(X,:,i), view(y,i))
-            @test @inferred(obsview((Xv,yv))[i]) == (view(X,:,i), view(y,i))
-            @test @inferred(obsview((XX,X,y))[i]) == (view(XX,:,:,i), view(X,:,i),view(y,i))
-            # compare if obs match in tuple
-            x1, y1 = getobs(obsview((X1,Y1))[i])
-            @test all(x1' .== y1)
-            x1, y1, z1 = getobs(obsview((X1,Y1,X1))[i])
-            @test all(x1' .== y1)
-            @test all(x1 .== z1)
-        end
-    end
-
-    @testset "custom types" begin
-        @test_throws MethodError obsview(EmptyType())
-        @test_throws MethodError obsview(EmptyType(), 1:10)
-        @test_throws BoundsError getobs(obsview(CustomType(), 11:20), 11)
-        @test typeof(@inferred(obsview(CustomType()))) <: ObsView
-        @test obsview(CustomType()) == ObsView(CustomType())
-        @test obsview(CustomType(), 2:11) == ObsView(CustomType(), 2:11)
-        @test numobs(obsview(CustomType())) === 15
-        @test numobs(obsview(CustomType(), 2:11)) === 10
-        @test getobs(obsview(CustomType())) == collect(1:15)
-        @test getobs(obsview(CustomType(), 2:11), 10) == 11
-        @test getobs(obsview(CustomType(), 2:11), [3,5]) == [4,6]
-    end
-end
-
 @testset "getobs!" begin
-    @test getobs!(nothing, obsview(y, 1)) == "setosa"
+    @test getobs!(nothing, ObsView(y, 1)) == "setosa"
 
     @testset "ObsView" begin
         xbuf1 = zeros(4,8)
@@ -194,13 +131,7 @@ end
 end
 
 @testset "ObsView other" begin
-    # @test ObsView <: AbstractVector
-    # @test ObsView <: DataView
-    # @test ObsView <: AbstractObsView
-    # @test ObsView <: AbstractObsIterator
-    # @test ObsView <: AbstractDataIterator
-    @test obsview === ObsView
-
+    
     @testset "constructor" begin
         # @test_throws DimensionMismatch ObsView((rand(2,10),rand(9)))
         # @test_throws DimensionMismatch ObsView((rand(2,10),rand(4,9,10),rand(9)))
@@ -238,11 +169,11 @@ end
             @test @inferred(numobs(A)) == 15
             @test @inferred(length(A)) == 15
             @test @inferred(size(A)) == (15,)
-            @test @inferred(A[2:3]) == datasubset(var, 2:3)
-            @test @inferred(A[[1,3]]) == datasubset(var, [1,3])
-            @test @inferred(A[1]) == datasubset(var, 1)
-            @test @inferred(A[11]) == datasubset(var, 11)
-            @test @inferred(A[15]) == datasubset(var, 15)
+            @test @inferred(A[2:3]) == obsview(var, 2:3)
+            @test @inferred(A[[1,3]]) == obsview(var, [1,3])
+            @test @inferred(A[1]) == obsview(var, 1)
+            @test @inferred(A[11]) == obsview(var, 11)
+            @test @inferred(A[15]) == obsview(var, 15)
             @test A[end] == A[15]
             @test @inferred(getobs(A,1)) == getobs(var, 1)
             @test @inferred(getobs(A,11)) == getobs(var, 11)
@@ -265,15 +196,15 @@ end
         for var_raw in (vars..., tuples..., Xs, ys)
             for var in (var_raw, ObsView(var_raw))
                 A = ObsView(var)
-                @test getobs(@inferred(obsview(A))) == @inferred(getobs(A))
+                @test getobs(@inferred(ObsView(A))) == @inferred(getobs(A))
     
-                S = @inferred(obsview(A, 1:5))
+                S = @inferred(ObsView(A, 1:5))
                 @test typeof(S) <: ObsView
                 @test @inferred(length(S)) == 5
                 @test @inferred(size(S)) == (5,)
                 @test @inferred(A[1:5]) == S[:]
                 @test @inferred(getobs(A,1:5)) == getobs(S)
-                @test @inferred(getobs(S)) == getobs(ObsView(obsview(var,1:5)))
+                @test @inferred(getobs(S)) == getobs(ObsView(ObsView(var,1:5)))
     
                 S = @inferred(ObsView(A, 1:5))
                 @test typeof(S) <: ObsView
@@ -281,7 +212,7 @@ end
         end
         A = ObsView(X)
         @test typeof(A.data) <: Array
-        S = @inferred(obsview(A))
+        S = @inferred(ObsView(A))
         @test typeof(S) <: ObsView
         @test @inferred(length(S)) == 15
         @test typeof(S.data) <: Array
diff --git a/test/shuffleobs.jl b/test/shuffleobs.jl
index 875428f..25b5384 100644
--- a/test/shuffleobs.jl
+++ b/test/shuffleobs.jl
@@ -58,33 +58,6 @@ end
     @test all(x1' .== y1)
 end
 
-# @testset "ObsView" begin
-#     # tests if all obs are still present and none duplicated
-#     ov = @inferred shuffleobs(obsview(X1))
-#     @test ov isa ObsView
-#     x1 = getobs(ov)
-#     @test sum(x1) == fill(120,10)
-#     # also tests that both paramter are shuffled identically
-#     ov = @inferred shuffleobs(obsview((X1,X1)))
-#     @test ov isa ObsView
-#     x1 = getobs(ov)
-#     for i = 1:length(x1)
-#         @test x1[i][1] == x1[i][2]
-#     end
-#     for i = 1:2
-#         @test sum(getindex.(x1,i)) == fill(120,10)
-#     end
-# end
-
-# @testset "BatchView" begin
-#     # tests if all obs are still present and none duplicated
-#     bv1 = batchview(X1, 30)
-#     bv = @inferred shuffleobs(bv1)
-#     @test length(bv) == length(bv1)
-#     @test bv isa BatchView{<:SubArray,<:SubArray}
-#     @test vec(sum(sum(bv),dims=2)) == fill(120,10)
-# end
-
 @testset "RNG" begin
     # tests reproducibility
     explicit_shuffle = shuffleobs(MersenneTwister(42), (X, y))